fluent / fluent/fluent-logger-java

Bad thread interleaving may cause unexpected crash

Aperta
#100 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
210
Fork
86
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.