This repository was archived by the owner on Apr 19, 2026. It is now read-only.
Commit 308f522
authored
Bugfix: data race in Service Control Client package (#64)
* Avoid data races leading to uninformative log entries.
A data race between flushAndSchedule* methods and stop() causes a
NullPointerException. The exception itself does not affect the operation
of the library, but generates misleading log entries.
Context:
Under normal condiions flushAndSchedule* methods repeatedly schedule
their own execution at constant time intervals. This way the library
achieves regular execution of flushes. The execution should stop when
the client is stopped. To achieve this, flushAndSchedule* methods reset
counters and return if they detect a stopped client.
Race condition:
Client.stop() method might be called in one thread, while
flushAndSchedule* are active. The method stop resets the field scheduler
which in a while is dereferenced at the end of flushAndSchedule* methods.
Solution:
In flushAndSchedule* methods, check if the client is stopped for the
second time towards the end of the function, just before dereferencing
the field scheduler. Also make a local copy of the field scheduler.
* Bump version to 1.0.141 parent aef637d commit 308f522
2 files changed
Lines changed: 22 additions & 4 deletions
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
357 | | - | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
358 | 364 | | |
359 | 365 | | |
360 | 366 | | |
| |||
394 | 400 | | |
395 | 401 | | |
396 | 402 | | |
397 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
398 | 410 | | |
399 | 411 | | |
400 | 412 | | |
| |||
435 | 447 | | |
436 | 448 | | |
437 | 449 | | |
438 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
439 | 457 | | |
440 | 458 | | |
441 | 459 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
0 commit comments