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

why gthread worker connections counter "self.nr_conns" doesn't need a lock ? #2861

Open
flowell opened this issue Sep 8, 2022 · 0 comments

Comments

@flowell
Copy link

flowell commented Sep 8, 2022

in gunicorn.workers.gthread.py

In order to avoid race condition, self.nr_conns -= 1 need a lock for protection or self.nr_conns need to be an automic integer?

...
    fs.add_done_callback(self.finish_request) # this mean "finish_request" will be execute in main thread or child thread?
...

def finish_request(self, fs):
    ...
    self.nr_conns -= 1 # race condition?
    ....

related issue

#2041

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