I just wrote some code for graceful restart of a web server, following
models available on the web.  Unlike those models, my code didn't work.
The parent (old) web server refused to exit.  The call to server.Shutdown
returned success, and the listener got closed, but the server.Serve call
never returned.  After some differential debugging, I figured out this was
because of an unexpected side effect of the File method of the listener:
it puts the connection in blocking mode.  In my case, I was calling that
method at the time I created the listener, which means the connection was
in blocking mode at the time server.Serve called its Accept method, so the
Accept never returned.  When I moved my call to the File method to happen
later, everything started working properly.

So now I'm curious:  _why_ does calling File on net.TCPListener change the
behavior of the listener?  Is that a bug that I should report?

Regards,
Steve

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to