Menu

#707 Possible data race crash

v1.1.x
fixed
v1.1.4
Bug Fix
2022-08-08
2022-05-19
Erik Hänel
No

The two random functions rand() and gauss() appear to cannot handle parallel execution due to data races occuring once the buffer runs out of elements. Possible solutions might be adding a semaphore or similar or by removing the buffers at all (keeping the generators as static variables) but that might result into a much higher runtime.

Analysis:

After changing that to a prototypic, global instance of the random number generator, the crash disappeared. As a consequence, the analysis made within the description is correct.

Implementation:

  • Implementation: Fixed by using a global central random number generator instance based upon a Mersenne-Twister-Engine (mt19937)
  • Revision: [r1150] ans [r1151]
  • Implementation test: Erroneous code was executed with multiprocessing activated. No crash was observed

Documentation:

  • [x] ChangesLog updated
  • [x] Code changes commented
  • Documentation articles:
    • [ ] corresponding documentation articles updated
    • [ ] new documentation articles created
    • [x] not needed
  • Language files:
    • [ ] corresponding language files updated
    • [x] not needed

Tests:

Cause of possible crash has been resolved. The actual race condition will be resolved within [#724].

Related

Commit: [r1150]
Commit: [r1151]
Tickets: #724

Discussion

  • Erik Hänel

    Erik Hänel - 2022-05-19
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2022-05-19
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,23 @@
     The two random functions `rand()` and `gauss()` appear to cannot handle parallel execution due to data races occuring once the buffer runs out of elements. Possible solutions might be adding a semaphore or similar or by removing the buffers at all (keeping the generators as `static` variables) but that might result into a much higher runtime.
    +
    +###Analysis:
    +(*Describe, what's the issue and which changes have to be made*)
    +
    +###Implementation:
    +* Implementation: (*Describe, what you've changed*) 
    +* Revision: [rXXX]
    +* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +
    +###Documentation:
    +* [ ] ChangesLog updated
    +* [ ] Code changes commented
    +* **Documentation articles:**
    
    +    * [ ] corresponding documentation articles updated
    +    * [ ] new documentation articles created
    +    * [ ] not needed
    +* **Language files:**
    +    * [ ] corresponding language files updated
    +    * [ ] not needed
    +
    +###Tests:
    +(*Describe, which tests you performed and their outcome*)
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2022-05-22
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,7 @@
     The two random functions `rand()` and `gauss()` appear to cannot handle parallel execution due to data races occuring once the buffer runs out of elements. Possible solutions might be adding a semaphore or similar or by removing the buffers at all (keeping the generators as `static` variables) but that might result into a much higher runtime.
    
     ###Analysis:
    -(*Describe, what's the issue and which changes have to be made*)
    +After changing that to a prototypic, global instance of the random number generator, the crash disappeared. As a consequence, the analysis made within the description is correct.
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    
    • status: analyzing --> implementing
     
  • Erik Hänel

    Erik Hänel - 2022-05-22
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,20 +4,20 @@
     After changing that to a prototypic, global instance of the random number generator, the crash disappeared. As a consequence, the analysis made within the description is correct.
    
     ###Implementation:
    -* Implementation: (*Describe, what you've changed*) 
    -* Revision: [rXXX]
    -* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +* Implementation: Fixed by using a global central random number generator instance based upon a Mersenne-Twister-Engine (`mt19937`)
    +* Revision: [r1150] ans [r1151]
    +* Implementation test: Erroneous code was executed with multiprocessing activated. No crash was observed
    
     ###Documentation:
    -* [ ] ChangesLog updated
    -* [ ] Code changes commented
    +* [x] ChangesLog updated
    +* [x] Code changes commented
    
     * **Documentation articles:**
         * [ ] corresponding documentation articles updated
         * [ ] new documentation articles created
    -    * [ ] not needed
    +    * [x] not needed
     * **Language files:**
         * [ ] corresponding language files updated
    -    * [ ] not needed
    +    * [x] not needed
    
     ###Tests:
     (*Describe, which tests you performed and their outcome*)
    
    • status: implementing --> testing
     

    Related

    Commit: [r1150]
    Commit: [r1151]

  • Erik Hänel

    Erik Hänel - 2022-08-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -20,4 +20,4 @@
    
         * [x] not needed
    
     ###Tests:
    -(*Describe, which tests you performed and their outcome*)
    +Cause of possible crash has been resolved. The actual race condition will be resolved within [#724].
    
    • status: testing --> fixed
     

    Related

    Tickets: #724

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB