Investigate threading issue in libtrace IO
|Reported by:||salcock||Owned by:||salcock|
If the change in r1681 is reverted, libtrace can segfault when reading traces on certain systems.
This appears to be due to a threading issue where the value of the len parameter passed into thread_read() is changed by another thread. This is in spite of the parameter being passed in by value rather than reference, as gcc appears to be optimising this parameter into a pass by reference. Disabling optimisations will prevent the problem from occurring.
The solution in r1681 is only treating the symptom, not the actual problem, so it would be good if we can find the point where the other thread touches something it shouldn't and put a mutex around it.
I've been able to replicate this on an Ubuntu 9.10 box using gcc 4.4.1 (for WAND folks, this is laptop "druid").