You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 22, 2019. It is now read-only.
At the StartProcess function, while Listener' s File() is called, this will puts the Listener fd into blocking mode. This should lead to Accept() can't return even if Listener.Close() is called.
Listener File() --> (fd *netFD) dup()
func (fd*netFD) dup() (f*os.File, errerror) {
ns, err:=dupCloseOnExec(fd.pfd.Sysfd)
iferr!=nil {
returnnil, err
}
// We want blocking mode for the new fd, hence the double negative.// This also puts the old fd into blocking mode, meaning that// I/O will block the thread instead of letting us use the epoll server.// Everything will still work, just with more threads.iferr=fd.pfd.SetBlocking(); err!=nil {
returnnil, os.NewSyscallError("setnonblock", err)
}
returnos.NewFile(uintptr(ns), fd.name()), nil
}
So, User either use Shutdown to close socket, or use syscall.SetNonblock to put the Listener fd into the nonblock.
The text was updated successfully, but these errors were encountered:
wllenyj
changed the title
After restarted, Listener.Accept() will not return even if Listener.Close() is called
After restarted, Listener.Close() doesn't lead Listener.Accept() to return
Aug 20, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
At the StartProcess function, while Listener' s File() is called, this will puts the Listener fd into blocking mode. This should lead to Accept() can't return even if Listener.Close() is called.
Listener File() --> (fd *netFD) dup()
So, User either use Shutdown to close socket, or use syscall.SetNonblock to put the Listener fd into the nonblock.
The text was updated successfully, but these errors were encountered: