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

Bad thread interleaving may cause unexpected crash #100

Open
Alisha-0321 opened this issue Nov 23, 2022 · 0 comments
Open

Bad thread interleaving may cause unexpected crash #100

Alisha-0321 opened this issue Nov 23, 2022 · 0 comments

Comments

@Alisha-0321
Copy link

Alisha-0321 commented Nov 23, 2022

Commit version - da14ec3

Describe the bug

It is possible to encounter an unexpected crash due to using the shared variable array in multiple locations (variable name is counters, in TestFluentLogger). In one place at Line 403 sets the value in this data-structure, whereas another location at Line 461 gets the value from this shared variable. However, there is no synchronization given between these accesses. As a result, anytime due to the existence of multiple threads, the program may crash.

Expected behavior
No crash is expected

Additional context
When I investigated the TestFluentLogger class, I found that the counters is a shared variable declared at Line 385 that is used at Line 403, Line 461. Here, the unexpected crash or inconsistency may occur if multiple threads interleave.

Environment:
I ran the test on an Ubuntu 20.04 LTS machine using OpenJDK 1.8.0_312.

@Alisha-0321 Alisha-0321 changed the title Bad thread interleaving may causes unexpected crash Bad thread interleaving may cause unexpected crash Nov 28, 2022
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