macournoyer / thin

A very fast & simple Ruby web server
https://rubygems.org/gems/thin
2.27k stars 345 forks source link

Increase timeout when checking for server stop #384

Closed sergiodj closed 2 years ago

sergiodj commented 3 years ago

On Ubuntu Impish (development version), we're currently facing a problem where thin's testsuite fails when it runs on an armhf system. After some investigation, I noticed that the reason for this failure was that the server was still running even after the loop on spec/spec_helper.rb:stop_server.

Given that the loop is actively checking to see if the server has stopped, I'd like to propose that the timeout be increased from 1 second to 10 seconds. Although I'm not a fan of the "let's-just-increase-the-timeout" type of solutions, in this particular case I think it's justified and makes sense (1 second may indeed be too quick for the server to properly stop).

ioquatix commented 2 years ago

It seems wrong to me to use a fixed loop like this.

I would suggest using an exponential backoff and then exiting with an error if it's still not dead after several iterations. Otherwise if we just exit and it's still running as you say, it causes the test suite to hang/fail.

sergiodj commented 2 years ago

It seems wrong to me to use a fixed loop like this.

I agree that the code is not optimal as is.

I would suggest using an exponential backoff and then exiting with an error if it's still not dead after several iterations. Otherwise if we just exit and it's still running as you say, it causes the test suite to hang/fail.

My proposal is just to increase the timeout so that we can mitigate the failures we're seeing on armhf. I can't promise I will have the time to work on anything more involved than that, I'm afraid.

ioquatix commented 2 years ago

Thanks for your effort. We can merge this, however this software is in maintenance mode FYI.