gunicorn icon indicating copy to clipboard operation
gunicorn copied to clipboard

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

Open flowell opened this issue 3 years ago • 0 comments

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

flowell avatar Sep 08 '22 17:09 flowell