engineer-man / piston

A high performance general purpose code execution engine.
https://emkc.org/run
MIT License
1.93k stars 243 forks source link

Overriding constraints as per docs/configuration.md #461

Open theiosif opened 2 years ago

theiosif commented 2 years ago

I'm trying to override the timeout value of 3 seconds by setting the PISTON_RUN_TIMEOUT environment variable (on my system hosting Piston), as per docs/configuration.md.

However, this appears to have no effect as my code gets SIGKILLed by. Piston after the default execution limit of 3 seconds.

Alternatively, POSTing to api/v2/execute with run_timeout=15000 results in receiving "message": "run_timeout cannot exceed the configured limit of 3000".

My question therefore would be how can the default values be overriden and where the code corresponding to picking up their configuration resides.

Brikaa commented 2 years ago

Hi @theiosif, do you have the latest Piston image via ./piston update? And are you setting the evironment variables via docker compose?

The code that picks up the configuration is here: https://github.com/engineer-man/piston/blob/37e83c981356a6fc7ac82224a20e93b01ed85264/api/src/config.js#L226

gouseferoz commented 2 years ago

I have the same problem. I am mentioning the "run_timeout": 3500 in the post body of my submission and the submission doesn't run. What can be done here?

gouseferoz commented 2 years ago

I have added the below code to the docker-compose.yaml file and for the submission post body, i updated the "run_timeout": 10000 and it worked for me.

environment:
            - PISTON_RUN_TIMEOUT=10000