Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase timeout values in Rest Client #1571

Open
delliott90 opened this issue Sep 1, 2023 · 2 comments
Open

Increase timeout values in Rest Client #1571

delliott90 opened this issue Sep 1, 2023 · 2 comments

Comments

@delliott90
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
There are two general places where a default timeout is specified. The CONNECT_TIMEOUT_DEFAULT in the RestApiClient.py, which is currently set to 2 seconds, and DEFAULT_TIMEOUT in the TimeoutHTTPAdapter, which is currently set to 5 seconds. Now that stix-shifter supports async API calls, these values can be raised, or at least passed through as configurable options.

Describe the solution you'd like
Timeout values can be configured to be higher if needed.

@delliott90
Copy link
Collaborator Author

Individual connectors will need to be looked as as I think some override the timeout value.

@subbyte
Copy link
Member

subbyte commented Sep 1, 2023

This may be related to #1493

If I understand the timeout issue right, it is caused by mixing the CPU-bound translation in IO-bound-intended asyncio (good for transmission). Increasing the timeout mitigates the problem, but the existence of the timeout indicates asyncio is blocked and not working as expected.

Another thing we may do is to educate users of stix-shifter on using the library: splitting translation and transmission as discussed in #1493 (comment) so asyncio will be effective---instead of simply calling translation and transmission as async functions, one needs to wrap the sync version of translation into run_in_executor() or use multi-processing since translation in essence is a CPU-bound task, which may not be helpful to run in async mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants