train icon indicating copy to clipboard operation
train copied to clipboard

Add timeout features

Open clintoncwolfe opened this issue 7 years ago • 3 comments

Description

Many connections have the possibility of timing out. Some underlying libraries will drop a connection after a value they know about, but Train doesn't.

Train and Platform Version

1.4.38

Replication Case

First reported with long-running tests on Docker, which drops after 5 min. A long-running InSpec run (sleep 360 perhaps) should trigger it.

Possible Solutions

A better UX would be to add timeouts, retries, and keepalive options, which could be used as much as possible with underlying libraries.

Also consider a ping-like check to verify the connection is still alive.

clintoncwolfe avatar Sep 19 '18 16:09 clintoncwolfe

I would really like to see that feature come to life. Would you maybe consider. to roughly guide me through the code (entrypoint to https://github.com/inspec/train/blob/master/lib/train/transports/docker.rb#L15) so that I could take a closer look?

stiller-leser avatar Oct 23 '18 13:10 stiller-leser

This is an escalated issue from a customer, and will be added to the next sprint

kekaichinose avatar Oct 22 '19 16:10 kekaichinose

This really comes down to whether the underlying connection library supports a timeout option. Timeouts are now supported in the SSH transport, the local transport for Unix and Windows Shell (non-Pipe) transports, and WinRM transports. So, this has been partially implemented.

For the docker transport to support timeouts, the docker-api gem would need to support a timeout option in the exec API call. It simply passes all options on to the docker engine API endpoint, which does not support any timeout options - https://docs.docker.com/engine/api/v1.41/#operation/ContainerExec .

clintoncwolfe avatar Apr 08 '21 00:04 clintoncwolfe