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

Fix a bug where TLS would become None #55

Merged
merged 2 commits into from
Sep 28, 2023
Merged

Fix a bug where TLS would become None #55

merged 2 commits into from
Sep 28, 2023

Conversation

notgull
Copy link
Member

@notgull notgull commented Sep 27, 2023

The bug is invoked as follows:

  • Runner 1 is created and stores the current version of the TLS LOCAL_QUEUE variable, which is None.
  • Runner 2 is also created. It stores the current version of the TLS variable as well, which is Runner 1's queue.
  • Runner 1 is dropped. It stores None into the LOCAL_QUEUE variable.
  • Runner 2 tries to run. It reads from the LOCAL_QUEUE variable, sees that it is None, and panics.

This could be solved by just not using the local queue if the variable is None. However, we can do one better; if the slot is open, we can optimize the runner by replacing it with our own queue. This should allow for the local queue to be used more often.

Closes #54

The bug is invoked as follows:

- Runner 1 is created and stores the current version of the TLS
  LOCAL_QUEUE variable, which is None.
- Runner 2 is also created. It stores the current version of the TLS
  variable as well, which is Runner 1's queue.
- Runner 1 is dropped. It stores None into the LOCAL_QUEUE variable.
- Runner 2 tries to run. It reads from the LOCAL_QUEUE variable, sees
  that it is None, and panics.

This could be solved by just not using the local queue if the variable
is None. However, we can do one better; if the slot is open, we can
optimize the runner by replacing it with our own queue. This should
allow for the local queue to be used more often.

Closes #54

Signed-off-by: John Nunley <dev@notgull.net>
src/lib.rs Outdated Show resolved Hide resolved
@taiki-e taiki-e marked this pull request as draft September 27, 2023 15:54
Signed-off-by: John Nunley <dev@notgull.net>
@notgull notgull marked this pull request as ready for review September 28, 2023 02:55
@notgull notgull merged commit 4154ad2 into master Sep 28, 2023
8 checks passed
@notgull notgull deleted the notgull/missed-sot branch September 28, 2023 03:01
@notgull notgull mentioned this pull request Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Panic with version 1.5.3
2 participants