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
frankli0324
changed the title
proposal: provide a way to get the unlink attribute of UnixListener. affected/package: net
proposal: net/UnixListener provide a way to get the unlink attribute.
Aug 1, 2022
ianlancetaylor
changed the title
proposal: net/UnixListener provide a way to get the unlink attribute.
proposal: net: UnixListener: provide a way to get the unlink attribute
Aug 2, 2022
it's actually a very specific case, but I felt it could be generalized...
I came along with some lines of code which enumerates all file descriptors, and SetUnlinkOnClose(false) if listener.(UnixListener). it passes these file descriptors to a subprocess created by StartProcess. by doing this, it achieves graceful restart. on startup, the code SetUnlinkOnClose(true) on all the listeners passed to it, removing all the file descriptors the parent passed to the child.
however, the common sense is that a listener should not be unlinked if it's not created by the process. so the parent process have to tell the child which fds are to be preserved by passing a list.
without the getter, the parent process have to maintain a list containing all the fds to be preserved upon creating the listeners, this adds complexity, concurrency locks (listeners are created asynchronously) and of course an extra global variable. but with a getter, the parent process only have to build that list when forking the child process.
#11826 prevents listeners not created by the process to be unlinked.
#13877 allows devs to explicitly specify whether go should unlink a listener
why does go design a setter
SetUnlinkOnClose
but not a getter? was there any concerns?would golang provide a getter?
The text was updated successfully, but these errors were encountered: