-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix two scenarios of RDataFrame JIT and explicit multithreading #15588
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
base: master
Are you sure you want to change the base?
Conversation
Test Results 14 files 14 suites 2d 19h 1m 0s ⏱️ For more details on these failures, see this check. Results for commit 0662195. ♻️ This comment has been updated with latest results. |
afc5aba
to
3249cec
Compare
3249cec
to
10ea292
Compare
This PR is related to this issue #15080 |
10ea292
to
7186526
Compare
@pcanal A second test was added for a different type of scenario (see the commit description). On my local tests, the changes in this PR already cover also the second scenario. |
Test a program with multiple threads managed explicitly by the user and each thread runs an RDataFrame with JITting. In particular, this test probes the following situation: * Threads start building the computation graph, code to JIT goes in a global accumulating string. * Thread 1 reaches the RLoopManager::Jit method. Checks the global string, it is not empty. * Thread 2 arrives as well, checks the string, it is not empty. * Thread 1 now takes a write lock on the string, moving it into the local function stack, thus leaving it empty. * Thread 2 wants to move the string as well, but just moves an empty string. * Thread 2 is faster than Thread 1 at passing its (empty) string to the `InterpreterCalc` function. * The `InterpreterCalc` function receives an empty string, thus will raise an exception since `gInterpreter->Calc("")` returns a `kDangerous` interpreter error code.
In an explicit multithreading scenario inside the `RLoopManager::Jit` method, a thread might move the global string with the code to JIT into its own function stack while another thread might still believe that string is not empty. This would make the other thread call `InterpreterCalc` with an empty string which would eventually lead to an exception. Check for the string emptiness twice, once at the beginning of the function, then again after taking the write lock so that if another thread already moved the string then the current thread will not continue with JITting.
For the following scenario: * Multiple threads, multiple different RDF computation graphs (one per thread). * Some threads run a valid, working computation graph, others have some problems. * Two classes of problems are used. The first is when the declaration of some code to JIT incurs in an error in the interpreter. The second is when there is an exception at runtime. * All problems are hidden explicitly by a try-catch scope. * Threads running a working computation graph should not be impacted by the threads that are running a flawed computation graph.
7186526
to
0662195
Compare
Re-opening this PR to check if the clad failures were real.