Repository navigation
Fix external memory race condition. - #4980
Conversation
|
Em... Seems dead lock on Windows. |
|
@trivialfis Is there a good way to make |
|
@hcho3 Probably. But after many attempts, I have only come to "having a vague intuition about what it's and general flow". For exactly how it works I have no idea. There might be an easier way to do parallel programming. But if you understand the implementation in dmlc core well please share some insight. I will try to make it more robust once I can catch up. |
|
@hcho3 Do we want to merge this one for now? You have more experience with |
|
@trivialfis Let's merge this for now. I'd like to take another look at ThreadedIter this weekend. |
|
@hcho3 I will merge this one later unless you think otherwise. From the look of it, thread iter is not designed to be thread safe. For a good implementation of thread primitives, I recommend the tbb library, it has many programming patterns that makes parallel programming robust. |
|
Wait. Somehow it's failing on the threading PR on Windows.. |
|
@trivialfis I see that you removed file locking from this PR. Now this PR only contains a change about GetColDensity(). Does this PR still "fix external memory race condition," as the name of the PR suggests? Otherwise, we should rename this PR. |
where is the failure? |
@trivialfis Can you elaborate a little bit more? I can use your insight here. I do share your sentiment here; for me it was unsafe concurrent accesses to raw pointers that got me worried the most. In the end, we may be better off re-writing ThreadedIter entirely. |
|
Yes. It fixed the race condition on colmaker. |
chyunsu3
left a comment
There was a problem hiding this comment.
Thanks for your clarification.
|
@hcho3
See the third error message posted on: #4619 it explicitly asked me not to do something concurrently.
Agreed. But that might be as huge as the JSON PR. So we need some plans and preferably we can share some ideas/algorithms/design patters on how to do it, otherwise we might build another pile of bugs. |
|
@trivialfis Thanks for the pointer. I agree about the need for planning. My experience is that writing thread-safe code takes lots of care (*). Let me first consider TBB, and ask whether an in-house implementation of ThreadedIter is called for. I will start a RFC for this. (*) https://www.manning.com/books/c-plus-plus-concurrency-in-action points out many common pitfalls in multi-threaded C++ programming. |
Closes #4619 , unblocks #4975 .
The file lock is not necessary forRemoved, it causes dead lock on Windows.colmaker, only added to be safe.Root cause for the fixed issue is, despite its name,
threadedIteris not thread safe.