-
Notifications
You must be signed in to change notification settings - Fork 18k
net: fix spurious netpoll "failed to associate" error on Solaris #7410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
This DTrace script confirms my hypothesis: #!/usr/sbin/dtrace -qs #pragma D option bufsize=16m syscall::*connect*:entry, syscall::*accept*:return, syscall::*socket*:return, syscall::close:entry, syscall::shutdown:entry /pid == $target/ { printf("%d %d %d %s: fd=%d\n", timestamp, cpu, tid, probefunc, arg0) } pid$target::port_associate:entry, pid$target::port_dissociate:entry { printf("%d %d %d %s: fd=%d\n", timestamp, cpu, tid, probefunc, arg2) } pid$target::port_associate:return { printf("%d %d %d %s: ret=%d, err: %d\n", timestamp, cpu, tid, probefunc, arg1, errno) } pid$target:a.out:runtime*throw:entry, pid$target:a.out:runtime*netpollupdate:entry { printf("%d %d %d %s\n", timestamp, cpu, tid, probefunc) } It produces this output: 8012180560989292 5 9 runtime.netpollupdate 8012180560990449 8 1 port_dissociate: fd=7 8012180560994819 5 9 port_associate: fd=7 8012180560996355 8 1 close: fd=7 8012180561000587 5 9 port_associate: ret=-1, err: 81 8012180561004031 8 1 port_dissociate: fd=6 8012180561009313 8 1 close: fd=6 8012180561015050 8 1 port_dissociate: fd=5 8012180561019511 8 1 close: fd=5 8012180561042683 5 9 runtime.throw Fields are timestamp, cpu it's running on, thread id, function, arguments or return values. Thread #9 enters netpollupdate and calls port_associate with fd=7, before port_associate returns, thread #1 calls close on fd=7. port_associate returns on thread #9 with EBADFD. What happens here is that the netpoller is unblocked in the normal I/O shutdown procedure. The netpoller runs in its own thread; closing the file descriptor happens in a different thread. The Solaris network poller has to re-arm itself because it uses level-triggered I/O. It indiscriminately re-arms itself, it doesn't check the reason for the wakeup. The fix is simple, make Solaris runtime·netpollupdate check if the PollDesc is closing and don't re-arm in that case. runtime_pollUnblock will set it to closing before unblocking the poller. |
This issue was closed by revision 199e703. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: