spring
spring copied to clipboard
Fix hangs when deleting / recreating project root with the same name
Fix for issue detailed in https://github.com/rails/spring/issues/396#issuecomment-345387012
If we have started a spring server, but the project root is deleted, the server can't successfully boot a child process. This is not recoverable. Even when the project is recreated, clients can also no longer communicate with the server because the socket path is derived from the project root (Dir.pwd) which for the server process no longer exists.
The proposed fix is to detect whenever a child cannot be started within a specific time frame - for whatever reason - rather than waiting indefinitely for the child to communicate with the ApplicationManager instance. This raises an error. If any error occurs when attempting to create a child process, we just abort - which shuts down the server gracefully.
This might not be a terribly common scenario, but I guess it can happen in real life - especially when people create throwaway projects to test stuff, or check out open source projects temporarily.
r? @rafaelfranca
(@rails-bot has picked a reviewer for you, use r? to override)
☝️ I'm not sure why CI failed. I tried a noop PR and that also failed :/