-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Let languages control multi threaded access ... is not allowed for language(s) js #8033
Comments
Option 1 and blocking is too opinionated, and deadlock prone. Many ways to do this, so I'd rather not standardize here. |
Great. From an Enso perspective, that's be a fantastic feature to have! |
@chumer thanks for the answer. Yes, option 2 would be absolutely amazing for us. Do you think it could be delivered on your end? If so, do you have any, even very approximate estimate for it? I'm asking about it, as it is kind of important topic for us :) |
Sorry no. We accept contributions, though. The necessary parts are all open source. |
Is #8266 an acceptable direction? |
Thank you! @JaroslavTulach |
Feature request
The Enso language implementation has managed to significantly simplify its interoperability with JavaScript in enso-org/enso#7882 thanks to
OtherContextTruffleObject
concept available in recent versions of GraalVM.I am especially thankful for removal of two thousand lines in https://github.com/enso-org/enso/pull/7882/files#diff-ccad61bee766711b658faf056e1a3f9381d9a05a9537edb2ac85774d039f0f6dL89 and related files.
Is your feature request related to a problem? Please describe.
However the functionality isn't completely on par - our original code implemented a GIL to avoid:
However there doesn't seem to be a way for us to implement such GIL now. We can live with it for now (as Enso runs single-threaded), but Enso isn't single-threaded language and we will need a solution in the future.
Describe the solution you'd like.
We'd like to control what happens instead of
IllegalStateException: Multi threaded access ... is not allowed
. Options:IllegalStateException
onEnter
andonExit
callback that would allow to synchronize access by locking ourselvesExecutor
that would be asked (by itsexecute(Runnable)
) method to perform all interop operations sent toOtherContextTruffleObject
Describe who do you think will benefit the most.
According to @kustosz (the creator of Enso language Truffle based interpreter) the current "Multi threaded access requested by thread main but is not allowed" isn't intuitive for people embedding Truffle languages into their Java applications at all.
I'd add: The behavior may be correct, but it is the least helpful of all possible behaviors. As Enso example shows, implementing the useful behavior requires quite a lot of code.
People who embed Truffle languages will find any kind of improvement far more friendly than the current behavior.
Describe alternatives you've considered.
We can obviously return those proxy files back and implement everything ourselves. I'd however prefer not doing so.
Additional context.
Enso provides rich support for embedding other languages: foreign section specification. Using other Truffle languages easily and smoothly straightens Enso as well as Truffle!
Express whether you'd like to help contributing this feature
One can simulate the problem in Enso test suite by removing @Ignore annotation from the test that runs JavaScript in parallel, but I can work on standalone examples that would simulate the behavior using non-Enso languages as well.
The implementation in
OtherContextTruffleObject
is probably too complicated to be enhanced by an outsider like me. It is a core feature behind native isolates (not sure what's the real name) and it is hard to contribute to it without having access to the native isolates. Easier if @tzezula does it ;-)The text was updated successfully, but these errors were encountered: