8000 Fix fluentsender forking issues by gregsterin · Pull Request #2 · gregsterin/fluent-logger-python · GitHub
[go: up one dir, main page]

Skip to content

Fix fluentsender forking issues #2

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

Open
wants to merge 2 commits into
base: affirm
Choose a base branch
from

Conversation

gregsterin
Copy link
Owner

Fix forking issues

@gregsterin
Copy link
Owner Author

Forking (when using multiprocessing with this logger) causes a few issues:

  1. forking doesn't copy threads, so the thread that consumes from the Async queue doesn't work
  2. if another thread is logging when the main thread forks, forking can copy the lock in a locked state, causing everything to deadlock in the new process.

Fix both by maintaining a lookup of the thread and lock based on the PID so this doesn't happen. Also recycle the queue based on PID to keep things clean.

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

Successfully merging this pull request may close these issues.

1 participant
0