jcrodriguez-dis / vpl-jail-system

Execution/jail server for VPL
GNU General Public License v3.0
23 stars 22 forks source link

Task files are deleted when monitor websocket is closed #75

Open Astor-Bizard opened 6 months ago

Astor-Bizard commented 6 months ago

Hello,

This problem does not occur with standard VPL plugin. However, I believe this is a design problem that leads to some errors when other systems try to communicate with the jail server.

Steps to reproduce:

Expected result: The last step should yield the result of the evaluation

Actual result: An error is raised:

Internal Server Error

Internal Server Error

Ticket invalid format

This error disappears if the step "properly close the websocket connection" is done last. Realistically, the close signal sent to the jail server makes it clean the task. Though not critical, this behaviour is not what it should be: closing the monitor websocket should not erase the evaluation result.

Astor-Bizard commented 6 months ago

Afterthought, I understand that stopping execution and cleaning the task upon websocket close is a way to respond to the VPL browser tab being closed, for example. In that case and if we want to keep this behaviour, it would at least be nice to have this documented somewhere :)

Best regards, Astor

jcrodriguez-dis commented 5 months ago

Dear @Astor-Bizard,

Thank you for your detailed bug report.

You've identified an issue where the monitor prematurely cleans up tasks when the websocket connection from the client is closed before the evaluation result retrieval is complete. This occurs because our code incorrectly stops monitoring and cleans the task if the websocket is closed, even though the task may still be in the retrieval phase.

We have address this problem (ed72898), now if the websocket is closed while the task is still in the "retrieve" state, the monitor will continue to wait until the retrieval process concludes or until the JAIL_HARVEST_TIMEOUT (set at 20 seconds) is reached.

While this fix should address the issue, I am open to exploring other strategies to manage potential endless waits more efficiently.

Again, thank you for bringing this to our attention.

Best regards, Juan Carlos