-
Notifications
You must be signed in to change notification settings - Fork 378
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
Event loop is regularly being blocked for longish periods #3302
Comments
Is there a way to construct a flame graph to support this? |
Actually, I tried pyflame with py3.7 and py3.6 and it doesn't work with either. For py3.7 the abi is not supported. I may reintroduce one of the tools we had for profilling |
Gevent already shows where the blocking occurs when running with the variables I mentioned above. For profiling there is also py-spy (which claims to support 3.3. - 3.7). |
We have done a lot of work on this issue, since blocking the event loop results in presence problems with the matrix transport, which led to transfer failures because the nodes appeared to be offline. There are still some longish periods of time were the loop may block, however, they are not a source of problem ATM. The next step should be to add benchmarks and create issues based on that. For now I'm closing this issue. |
Problem Definition
Using the gevent monitoring thread (enable by setting the env var
GEVENT_MONITOR_THREAD_ENABLE=1
) shows that we're regularly blocking the event loop for longish periods (the max allowed blocking time can be controlled viaGEVENT_MAX_BLOCKING_TIME
, I used0.1
and0.5
as an example).The main blocking culprits seem to be:
Possible solutions
For sqlite there is gsqlite3 which on paper sounds like a solution.
For the state machine we should look into using persistent / functional datastructures as a way to avoid having to use deepcopy. Pyrsistent looks promising.
The text was updated successfully, but these errors were encountered: