Skip to content

Comment on Graceful server restart with Go

Comments

Goagain by Richard Crowley is a great package that we are using for graceful restarts: https://github.com/rcrowley/goagain

EDIT: added author

I found that it corrupts the FD by using this call:

https://github.com/rcrowley/goagain/blob/master/goagain.go#L...

Not sure why it happens though, but it led to all sorts of strange intermittent issues with broken connections.

Once I replaced this logic with passing files using GetFile().Fd() instead it started working fine, so beware of this. I still wonder why it happens though.

Thanks for this.

Were you able to publish your changes either on a fork or in a PR?

I ended up using different library:

https://github.com/gwatts/manners

But the code that extracts the fd without using reflection and access to the private properties is here:

https://github.com/mailgun/manners/blob/master/listener.go#L...

I think it should be fairly easy to port it to Richard's implementation

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.