Changing Epoll mode for Golang runtime

121 views
Skip to first unread message

armin afsharian

unread,
Jun 3, 2024, 3:42:23 PMJun 3
to golang-nuts

Hi there,

For my research project, I'm trying to change the Go runtime to use "Epolloneshot" instead of the default "Edge-Triggered" mode. Based on what I've gathered from the code, I've changed two functions in src/runtime/netpoll_epoll.go.

First, I updated the netpollopen function to use the Epolloneshot flag instead of the Epollet flag. Second, I modified the netpollarm function, which isn't used in Linux, to rearm notifications for Epolloneshot. I also tweaked poll_runtime_pollWait() in src/runtime/netpoll.go to call netpollarm for Linux.

Now, I'm running into an issue where HTTP tests for compiling Go are failing. Here's the error I'm seeing:

"httptest.Server blocked in Close after 5 seconds, waiting for connections:

*net.TCPConn 0xc000221520 127.0.0.1:51836 in state active

panic: test timed out after 9m0s"

I suspect that the rearming might be incorrect, causing the server to stall indefinitely.

Just so you know, I'm using Ubuntu 22.04 and Go 1.18.10.

Ian Lance Taylor

unread,
Jun 3, 2024, 5:36:49 PMJun 3
to armin afsharian, golang-nuts
I don't know what the problem is.

That said, look at how netpoll_solaris.go calls netpollupdate from netpoll.

Ian
Reply all
Reply to author
Forward
0 new messages