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

Data race when multiple threads write to log files #118

Open
jfilby opened this issue Aug 12, 2022 · 1 comment
Open

Data race when multiple threads write to log files #118

jfilby opened this issue Aug 12, 2022 · 1 comment

Comments

@jfilby
Copy link

jfilby commented Aug 12, 2022

I've found that Chronicles can have a race condition, where memory gets corrupted, when logging from multiple threads. This is even with each thread logging to its own file. This leads to threads dying, often silently.

Attached is a test case that reproduces this issue. You may have to run it multiple times, but most of the time the test doesn't finish for me (no error or exception), the program just dies. Sometimes it does generate an exception when something breaks (because of the memory being corrupted).

I found the cause of the problem by using valgrind --tool-helgrind on Linux which shows data race errors in a larger program I'm testing. The issue happens on Windows too.

@jfilby
Copy link
Author

jfilby commented Aug 13, 2022

Attached is the test case source and the results from running the test with valgrind --tool-helgrind on Linux.
chronicles_data_race_test.zip
helgrind.zip

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

No branches or pull requests

1 participant