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

Add threading condition back to events daemon #2379

Merged
merged 1 commit into from Oct 10, 2017

Conversation

danlamanna
Copy link
Member

@danlamanna danlamanna commented Oct 4, 2017

Partially revert "97bdf57886d0a847c"

This fixes an issue where the event daemon was never actually being
terminated. Coverage shows while self.terminate gets set to True, the
log message printing the stopped message never actually gets run. This
is due to a bug where we indefinitely block for another item off the
queue in the middle of our 'while not terminate' clause.

Looking at this now, I suppose the daemon would actually get terminated but it would require a single event get processed after stop was called.

Random architectural thoughts about the events daemon:

  • Maybe the daemon should /have/ a thread and not /be/ a thread
    Since python threads can't be "restarted" but an events daemon could and arguably should.
  • No other thread is joining this thread, so I think it may be hanging around until CherryPy stops
    This isn't a big deal in the case of running Girder under CherryPy, but if the events daemon were to be used elsewhere it might be nice to enclose the logic (or maybe not).

@zachmullen You originally wrote the threading condition logic I want to restore, and I went through a bit of weeds to find this bug so I may have gotten a thing or two wrong, mind taking a look?

This fixes an issue where the event daemon was never actually being
terminated. Coverage shows while self.terminate gets set to True, the
log message printing the stopped message never actually gets run. This
is due to a bug where we indefinitely block for another item off the
queue in the middle of our 'while not terminate' clause.
@zachmullen
Copy link
Member

This looks like a good fix (once I read through the docs and discovered that the default lock for Condition can be acquired multiple times on the same thread).

Was this the cause of all those random error messages during testing? Or did the underlying problem present in some other way?

@danlamanna
Copy link
Member Author

danlamanna commented Oct 5, 2017 via email

@jbeezley
Copy link
Contributor

jbeezley commented Oct 5, 2017

I think he's talking about this #642. It's before your time :P.

@zachmullen
Copy link
Member

@jbeezley that's a bingo!

@zachmullen zachmullen merged commit c0f4bf0 into master Oct 10, 2017
@zachmullen zachmullen deleted the fix-events-daemon-not-terminating branch October 10, 2017 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants