Skip to content

Fix for #11407#11447

Merged
pllim merged 2 commits into
astropy:masterfrom
embray:issue-11407
Apr 1, 2021
Merged

Fix for #11407#11447
pllim merged 2 commits into
astropy:masterfrom
embray:issue-11407

Conversation

@embray

@embray embray commented Mar 30, 2021

Copy link
Copy Markdown
Member

This reverts the workaround for #11407 and provides a fix that addresses the underlying bug (which can be reproduced locally under the right conditions).

The bug was a race condition whereby the SAMPWebClient (which makes pullCallbacks calls to the hub, which is how SAMP web clients perform long polling) unregisters itself from the hub, but then immediately makes a pullCallbacks request (since the unregistration happened between if self._is_registered and the pullCallbacks call here).

In normal practice this would be a rare race condition, though on busy CI servers it's probably more common as there can be more delay between context switches.

This bug probably has existed for a while but was merely masked by the bug fixed by #11391.

embray added 2 commits March 30, 2021 11:25
…ient:

* Its server loop (for accepting calls from the Hub) should block
  until the client has actually registered with the hub (rather than
  busy waiting)

* More importantly, there needs to be a lock associated with whether
  or not the client is registered.  The lock does not need to be
  held by SAMPWebClient.register because the _server_thread blocks
  until the _registered_event is set.  However, SAMPWebClient.unregister
  does need to hold the lock to ensure it does not unregister the client
  when it is about to perform a pullCallbacks request to the hub.
…d now be

fixed.

Please unrevert again if there are still problems with this test :)
@embray embray added testing Affects-dev PRs and issues that do not impact an existing Astropy release samp labels Mar 30, 2021
@embray embray added this to the v4.0.6 milestone Mar 30, 2021
@github-actions github-actions Bot removed the testing label Mar 30, 2021
@embray embray added the testing label Mar 30, 2021

@pllim pllim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@pllim

pllim commented Mar 30, 2021

Copy link
Copy Markdown
Member

Since this fixes a long standing bug, I think it needs a change log. The "affects dev" portion is just for reverting my hacky test patch. But let's hold off on the change log until after towncrier is in place.

@embray

embray commented Apr 1, 2021

Copy link
Copy Markdown
Member Author

Since this fixes a long standing bug, I think it needs a change log. The "affects dev" portion is just for reverting my hacky test patch. But let's hold off on the change log until after towncrier is in place.

Ok, though the bug is still just in code that's only used in the tests. It's not code that is ever intended for use by users. It's code that's mean to emulate someone using a browser-based SAMP implementation.

@pllim

pllim commented Apr 1, 2021

Copy link
Copy Markdown
Member

Ah, okay. No need for change log then. Thanks!

@pllim pllim merged commit aa8328f into astropy:master Apr 1, 2021
eteq pushed a commit that referenced this pull request Apr 2, 2021
@embray embray deleted the issue-11407 branch April 6, 2021 16:40
astrofrog pushed a commit that referenced this pull request Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release samp testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants