[systemd-devel] Invalid poll event on socket

Lennart Poettering lennart at poettering.net
Tue Apr 26 12:39:42 PDT 2011


On Mon, 25.04.11 11:58, Albert Strasheim (fullung at gmail.com) wrote:

Heya,

> On Mon, Apr 25, 2011 at 10:03 AM, Albert Strasheim <fullung at gmail.com> wrote:
> > With systemd 25 I get:
> >> systemd[1]: Got invalid poll event on socket.
> > systemd[1]: foo.socket: Got invalid poll event (0x11) on socket.
> 
> I think I know what's going on here.
> 
> My service that is consuming this socket is written in Go.
> 
> Go currently has an issue where if you close a socket, it also calls
> shutdown on that socket. This has been discussed on the Go mailing
> list, but not fixed yet:
> 
> http://groups.google.com/group/golang-dev/browse_thread/thread/c6ef223b67936f07
> 
> It seems this happens even for listen sockets, which causes an
> EPOLLHUP, which is 0x10.

Ah, interesting. I wasn't aware that shutdown() on a listening socket
has this effect. I wonder why the kernel allows that...

> Maybe systemd needs to guard against this kind of "buggy" service
> behavior, where the service "cleans up" the socket that systemd has
> passed to it?

Hmm, so thinking about this I came to the conclusion that the right
reaction of systemd is to make the socket enter fail mode on POLLHUP. We
should not try to tape over the problem by silently recreating the
socket.

That said we should definitely print a more useful warning message. I
have now updated git to do that and even point out that shutdown() might
be the culprit.

Thanks for tracking this down,

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list