[systemd-devel] Getting EOF on FD#1 stdout (a service using socat)

Lennart Poettering lennart at poettering.net
Mon Jul 27 04:16:32 PDT 2015


On Mon, 27.07.15 11:31, John Lane (systemd at jelmail.com) wrote:

> I have a problem with what I thought would be a simple service unit:
> 
>     # /etc/systemd/system/socat.service
>     [Service]
>     ExecStart=/usr/bin/socat UDP-RECV:4321 STDOUT
> 
> The expected outcome is that "/usr/bin/socat UDP-RECV:4321 STDOUT" is
> started with its standard output connected to the journal.
> 
> However, the service terminates immediately without error. I've looked
> into it and notice that socat is getting an EOF on FD#1, its standard
> output, and it then terminates:

EOF on an output fd is bogus.

EOF is when an input stream ends, it's indicated by read() returning 0
instead of > 0. It's not defined for output fds, as then EOF isn't an
event you receive but an event you send.

This hence seems like confusion on socat's side. Most likely they are
treating a POLLHUP on the stdout fd as an EOF on stdin or so. They
shouldn't do that, it's a bug only they can fix.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list