Skip to content

Conversation

seewindcn
Copy link
Contributor

Pool object call GreenletIdent.watch(on_thread_died) and not unlink. if the greenlet is resident, greenlet._links is growth

Pool object call GreenletIdent.watch(on_thread_died) and not unlink. if the greenlet is resident, greenlet._links is growth
@ghost ghost assigned ajdavis Jun 20, 2013
@ajdavis
Copy link
Member

ajdavis commented Aug 16, 2013

Merged, thanks!

@ajdavis ajdavis closed this Aug 16, 2013
@ajdavis
Copy link
Member

ajdavis commented Aug 17, 2013

Summary: When a Gevent Greenlet calls MongoClient.start_request(), it reserves for itself a socket to use until it calls end_request() or dies. We use Greenlet.link(callback) to know if a Greenlet dies without calling end_request(). We had a bug that failed to clear the callback if the Greenlet calls end_request() before it dies, so the callback would fire even though there was no work for it to do.

This wasn't a big problem in PyMongo since the callback sees that it has no work to do, and exits normally. But if a Greenlet calls start_request and end_request repeatedly, we attached a growing list of useless callbacks to it. Additionally, this unexpected behavior was a likely source of future bugs if we ever changed the callback code.

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.

2 participants