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

Hotswap documentation example code has a race condition #3884

Closed
arosien opened this issue Oct 31, 2023 · 1 comment
Closed

Hotswap documentation example code has a race condition #3884

arosien opened this issue Oct 31, 2023 · 1 comment

Comments

@arosien
Copy link
Contributor

arosien commented Oct 31, 2023

The Hotswap documentation has an example where a Hotswap is used to manage a rotating file handle, but introduces a race condition attempting to store the current file into a Ref after the swap occurs. If a different fiber tries to write a log line, the Ref is read, but it could have been released from a swap call before the Ref.set call happens.

Instead the example should only use Hotswap.get to act on the current file handle.

@arosien
Copy link
Contributor Author

arosien commented Jan 17, 2024

thanks @armanbilge !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants