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

the return result are not in right order #148

Open
qiuwenhui1 opened this issue Oct 26, 2023 · 1 comment
Open

the return result are not in right order #148

qiuwenhui1 opened this issue Oct 26, 2023 · 1 comment
Labels

Comments

@qiuwenhui1
Copy link

qiuwenhui1 commented Oct 26, 2023

sandbox.setMaxCPUTime(1000);
sandbox.setMaxMemory(1024 * 1024 * 50L);
sandbox.setExecutor(Executors.newFixedThreadPool(2));
sandbox.eval(script);

I create two thread to run the follow:
Object object = sandbox.getSandboxedInvocable().invokeFunction(DECODE_FUNCTION, message);
My script can return two different result according to the params in message. But the return result are not int right order.
So I change the executor to Executors.newSingleThreadExecutor(). And the order is right. But reach the memory limit after run for a few time.
I guass is there any threading issues when executor has more than one thread? And the memory monitor calcute
inaccurete when the executor has one thread?

@mxro
Copy link
Collaborator

mxro commented Oct 26, 2023

Thank you for raising this issue!

If there are is only one or multiple executors defined for the sandbox shouldn't affect the logic in DECODE_FUNCTION - since each time that runs, it will run in a single thread from start to finish! Unless there are variables shared between executions?

Difficult to say more without more context around where invokeFunction is called and what the code in DECODE_FUNCTION is!

@mxro mxro added the question label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants