You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/04 03:00:43 UTC

[GitHub] [arrow] westonpace commented on issue #12329: An unhandled race condition exists in `ThreadPool`

westonpace commented on issue #12329:
URL: https://github.com/apache/arrow/issues/12329#issuecomment-1029593224


   It's been a little bit since I've looked at this but if I recall correctly the condition `pid_ != current_pid` will only be true after a fork.  When a fork happens the child (the one that gets the new pid) will not have any running threads except the thread that called fork.
   
   We would then go into this branch and reinitialize the state before any worker thread could possibly be launched.  I suppose however, if there were two user threads (e.g. created by the arrow library user and not worker threads in the thread pool) that simultaneously trigger calls to SpawnReal then we could get into a race condition.
   
   Our options may be somewhat limited here due to the nature of fork.  I'm not entirely sure how `compare_exchange_strong` can be used here.  What would the values of `expected` and `desired` be?  Since it is a negative check we would need "expected" to be "anything but current_pid" and desired to be "current_pid" but I don't think we can use `compare_exchange_strong` in that negative way.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org