eshaan7 / Flask-Shell2HTTP

Execute shell commands via HTTP server (via flask's endpoints).
https://flask-shell2http.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
170 stars 28 forks source link

Seeing intermittent future_key errors #53

Open bfeist opened 1 year ago

bfeist commented 1 year ago

2023-04-25 23:12:39 ERROR:flask_shell2http:future_key ebbb407f already exists 2023-04-25 23:12:39 ERROR:flask_shell2http:No report exists for key: 'ebbb407f'.

These are interspersed with working calls.

I turned off wait=true and switched to polling. This reduced the problem but didn't eliminate it.

Are there any docs on how to endure the key doesn't already exist? I don't believe I'm managing the keys externally to shell2http.

Thanks so much.

eshaan7 commented 1 year ago

Hi. Can you tell the version of python and flask-shell2http being used and with what server is your flask code deployed?

eshaan7 commented 1 year ago

Can you also tell if your client tries to execute same command with the same args multiple times? If that is the case, you might want to set the force_unique_key parameter to true (see example).

Hint By default, the key is the SHA1 sum of the command + args POSTed to the API. This is done as a rate limiting measure so as to prevent multiple jobs with same parameters, if one such job is already running. If force_unique_key is set to true, the API will bypass this default behaviour and a psuedorandom key will be returned instead.

-- docs (see 2nd hint)

bfeist commented 1 year ago

Ah this explains it. Yes, several calls with the same parameters are possible. I'll have a look at how to force_unique_key. Thanks for the followup.