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

Held lock in parent worker copied to children causes worker hangs #1

Open
ChristopherWilks opened this issue Mar 24, 2020 · 0 comments

Comments

@ChristopherWilks
Copy link
Collaborator

This has been known for a while, but finally documenting it here. It's happened on MARCC, AWS EC2, and Stampede2.

When the initial cluster.py process starts (parent) it will eventually fork child worker processes via python's multiprocessor module. This mostly works well, and gets around the GIL.
However, one of the other modules being used uses one or more locks within its library (not our code) which are frequently copied while still locked, as part of the inherited memory of the child processes.

However, the unlock signal is only received by the original lock in the parent python process, the children who inherited the lock never get it, and thus silently hang until terminated by an external signal.

The hang always comes before any work is done, during initialization. Both SQLAlchemy and the logging module (via queues) use locks and are major suspects.

Attempts have been made to fix this by passing references to the logging queue and the SQLAlchemy db handle, they have continually failed. This makes me think there are multiple locks being inherited where this can happen, not just one.

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

1 participant