Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix thread safety issue in process cleanup
authorGabriel Corona <gabriel.corona@loria.fr>
Fri, 19 Jun 2015 09:34:54 +0000 (11:34 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Thu, 25 Jun 2015 12:36:57 +0000 (14:36 +0200)
While trying to find the root cause of the occasional failure of the
kademlia test, I found a thread-safety issue here:

When running in parallel mode all worker threads can call the
`SIMIX_process_cleanup()` concurrently which does things such as:

~~~c++
XBT_DEBUG("%p should not be run anymore",process);
xbt_swag_remove(process, simix_global->process_list);
xbt_swag_remove(process, SIMIX_host_priv(process->smx_host)->process_list);
xbt_swag_insert(process, simix_global->process_to_destroy);
~~~

The SWAG are modified concurrently by the worker threads without
synchronization. Sometimes, they go into inconsistent states (for
example, `swag->count` is no more consistent with the number of
elements really in the swag).

This fix might not be the best way to do it.


No differences found