Skip to content
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

<parameter name> is not defined #1109

Closed
ghost opened this issue Mar 17, 2022 Discussed in #1108 · 4 comments
Closed

<parameter name> is not defined #1109

ghost opened this issue Mar 17, 2022 Discussed in #1108 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 17, 2022

Discussed in #1108

Originally posted by source-transformer March 17, 2022
JINT will sometimes fail with a JavaScriptException

"<parameter name> is not defined"

There is a unit test that replicates this failure.

@ghost
Copy link
Author

ghost commented Mar 18, 2022

It looks like this might be a symptom of using the JINT engine across multiple threads.

When I changed the above setTimeout implementation to be on the main thread - the issue doesn't occur.

Just wanted to call that out since I think we can restrict our usage of each Engine to a single thread.

@lahma
Copy link
Collaborator

lahma commented Mar 18, 2022

Jint is by design not thread-safe, so "odd things happening" might stem with multi-threaded usage.

@ghost
Copy link
Author

ghost commented Mar 21, 2022

As a way to give a "fail early, fail fast" exception - I've created a PR with a "thread check":

#1110

I'm happy to put this "thread safety" check behind an optional config when you initialize the Engine if this seems overly precautious.

@lahma
Copy link
Collaborator

lahma commented Mar 12, 2023

I've added API documentation on Engine level and in main README in #1489 to highlight the fact that engine is not thread-safe. The PR can be used for possible development, but as noted in #1110 (comment) it's not very simple to implement correctly.

Easiest path probably to make things evident enough via docs etc the same way like .NET's Dictionary<T, K> not being thread-safe.

@lahma lahma closed this as completed Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant