Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition during Parcel Coalescing Handler creation #2517

Closed
sithhell opened this issue Feb 22, 2017 · 4 comments · Fixed by #2522
Closed

Race condition during Parcel Coalescing Handler creation #2517

sithhell opened this issue Feb 22, 2017 · 4 comments · Fixed by #2522

Comments

@sithhell
Copy link
Member

The message handler creation functions currently unlock the lock when creating a new message handler. This might lead to a race condition when constructing coalescing handlers concurrently due to multiple insertions of the same counter functions as well as when adding the callbacks for the runtime config

@hkaiser
Copy link
Member

hkaiser commented Feb 22, 2017

@sithhell I thought this was handled by this code: https://github.com/STEllAR-GROUP/hpx/blob/master/src/runtime/parcelset/parcelhandler.cpp#L708-L718. Did you have something else in mind?

@sithhell
Copy link
Member Author

Unfortunately not. This is not about the insertion into the map. The problem is here:
https://github.com/STEllAR-GROUP/hpx/blob/master/src/runtime/parcelset/parcelhandler.cpp#L702
In the case of parcel coalescing, we eventually end up calling this: https://github.com/STEllAR-GROUP/hpx/blob/master/plugins/parcel/coalescing/coalescing_counter_registry.cpp#L45-L77
which is then not protected by any lock.

@sithhell
Copy link
Member Author

In addition, even if the code shown was protected by a lock, we might end up with stale callbacks if the message handler was constructed twice due to a race.

@hkaiser
Copy link
Member

hkaiser commented Feb 22, 2017

Right, good catch. I think I know how to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants