robur-coop / builder

Scheduling build jobs on regular intervals, collecting artifacts
ISC License
13 stars 1 forks source link

worker: Handle timeouts/closed sockets from server #29

Closed reynir closed 1 year ago

reynir commented 1 year ago

This is a quick and dirty implementation of an alternative to https://github.com/roburio/builder/pull/28.

The worker forks before executing the job.
The child executes the job and sends the result over a pipe (using Marshal).
The parent uses Unix.select to wait for input from either the builder-server (including EOF) or the pipe. If the builder-server sends anything or closes the socket the child process is terminated and builder-worker exits. Otherwise the result is read from the pipe and forwarded to the server.

I have not tested this.

hannesm commented 1 year ago

Thanks for working on this. I appreciate that. But this makes the code more complex (yet another process that needs to be communicated with). Also, it is not clear to me if the builder-server actually closes the socket (we should indeed check this)... I merged the other PR since I feel that timeout is a pretty safe first cut.

I opened #30 to track that.