maelstrom-software / maelstrom

Maelstrom is a fast Rust, Go, and Python test runner that runs every test in its own container. Tests are either run locally or distributed to a clustered job runner.
https://maelstrom-software.com/
Apache License 2.0
559 stars 11 forks source link

Remote log messages get lost sometimes on shutdown #410

Open bobbobbio opened 1 month ago

bobbobbio commented 1 month ago

Specific Maelstrom Program? Anything using the client

Bug Description When running a test runner or using the client programmatically with the log level set to debug sometimes remote log messages are getting lost especially if we exit early due to an error.

How to Reproduce It is basically a race, so it is hard to get it to happen. I don't have an easy way.

Expected Behavior All the log messages should be preserved. In fact if there are log messages from the shutdown process of the child process, it would be nice to receive as many of those as we can as well.

Additional Context Fixing this I think will involve changing the shutdown process of the client process. Right now the client closes its socket and this signals to the remote side that it needs to shutdown. This isn't good because there might be log messages that have been sent but we will never receive because we closed the socket. Instead I think it would be better to somehow send some message or signal to the client process telling it we want it to shut down, then the client can wait for the child process to close the socket. This would allow us to receive in-flight log messages before exiting.