feat: Refine HTTP timeouts across numerous analyzers and ingestors. Closes #3495#3501
Conversation
…cross numerous analyzers and ingestors.
…eferences, and function signatures.
|
Hey @mlodic, I've finished implementing the centralized The default timeout is now set to 30s as requested. Please have a look and let me know if everything looks good!
|
|
it seems a bit overkill to be honest and could result in possible unwanted behaviors. Not sure if it is worth adding this. |
|
I totally understand the concern about breaking long-running analyzers. The reason I thought the HTTP-level timeout was useful is that it allows the analyzer to catch the timeout exception and fail gracefully (showing a nice error in the UI) rather than having Celery kill the entire task, which can be a bit more abrupt. That said, since my |
|
To address the 'wanted behavior' concern, what if I increase the default timeout to 60 or 90 seconds? That would still prevent truly 'infinite' hangs while being safe for slow analyzers. Or, if you prefer, I can revert the mass migration and only apply this new |
|
90 seconds is definitively better |
… application settings.
…et_timeout_from_request_header`.
mlodic
left a comment
There was a problem hiding this comment.
are there any other places where the previously existing timeout has been changed?
…alth and availability checks.
|
The only spots where I'd accidentally changed an existing short timeout were the health_check methods. I've now reverted those back to the original 10s so they stay fast. |


Description
This PR implements a centralized HTTP timeout mechanism project-wide to prevent indefinite hangs in Celery workers, as said in issue #3495.
Key changes:
HTTP_TIMEOUTsetting inintel_owl/settings/commons.py(default 30 seconds).api_app/http_utils.pyfor therequestslibrary which automatically applies the default timeout to all requests (including a newSessionwrapper).requestscalls tohttp_utils.health_checkmethod inapi_app/analyzers_manager/classes.pyto usesettings.HTTP_TIMEOUT.quoteandurljoinimports inmmdb_server.pyandmalprob.py.Ruff, ensuring 0 linting errors.AttributeError,TypeError) caused by the migration.Type of change
Checklist
developdumpplugincommand and added it in the project as a data migration. ("How to share a plugin with the community")test_files.zipand you added the default tests for that mimetype in test_classes.py.FREE_TO_USE_ANALYZERSplaybook by following this guide.urlthat contains this information. This is required for Health Checks (HEAD HTTP requests).get_mocker_response()method of the unittest class. This serves us to provide a valid sample for testing.DataModelfor the new analyzer following the documentation# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl # See the file 'LICENSE' for copying permission.(Retained in migrated files)urllib.parsewhich is standard library)Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.testsfolder). All the tests (new and old ones) gave 0 errors.DeepSource,Django Doctorsor other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.