You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hotfix bound threads for workers unsafe calls for llvm (#4081)
Fixes a problem with recently-introduced thread-local storage in the
LLVM backend.
We have to make sure that all foreign calls relating to an LLVM-based
term evaluation use the same OS thread, which can only be achieved [via
bound
threads](https://downloads.haskell.org/ghc/latest/docs/libraries/base-4.20.0.0-1f57/Control-Concurrent.html#g:8)
.
This PR
* adds a flag to the generic RPC server in `kore-rpc-types` to run
request worker threads in bound threads (using `forkOS`)
* `kore-rpc-booster` uses this flag for bound threads when an LLVM
backend library is used
* declares the LLVM backend calls `unsafe` to make executing OS threads
block instead of having new OS threads created for concurrent Haskell
execution (they won't read HS heap data and never call back into
Haskell).
This _should_ protect us against problems related to using thread-local
storage in the LLVM backend. Needs to be thoroughly tested before
merging, because issues only materialised in proofs with substantial
workload and parallel exploration.
PR #4080 uses `runInBoundThread` on the individual request processing
calls instead of running the whole worker thread in the server as a
bound thread. This was not solving the problem.
0 commit comments