Broken pipe with own dict server. Timing issue?
martijn.list
martijn.list at gmail.com
Fri Apr 8 08:08:58 UTC 2016
Hi,
I have created my own dict server (proxy:[<dict path>]:<destination
dict>) to access a proprietary database. The dict server basically
creates a listing socket on a separate thread and then waits for
incoming requests with accept(handle, NULL, 0). When a request comes in
(i.e., when accept returns the accepted socket fd), the request is
handed over to a handler thread (from a thread pool). The handler thread
then read from the input.
The issue that I have is that if the read is done too fast after the
accept, Dovecot reports a broken pipe:
dovecot: auth-worker(19904): Error:
write(/usr/share/test-server/tmp/test-dict) failed: Broken pipe
This happens for almost all processes that try to access the dict server.
However If I add some sort of delay between the accept call and read
(for example a sleep), everything works. No broken pipe even after
testing with a large number of parallel requests for a long time.
Somehow it looks like if the first read is done too fast, it takes a
long time to read the data. During this time it looks like all other
Dovecot processes are no longer able to connect and report the broken
pipe. With the artificial delay, everything works ok and I can see that
multiple incoming request are handled by multiple threads so it looks
like Dovecot uses multiple auth worker processes. If however one
connection hangs on the read it looks like no Dovecot proccess is able
to connect
Any idea what might be causing the broken pipe in relation to timing of
the read?
Kind regards,
Martijn
More information about the dovecot
mailing list