On 08 Apr 2016, at 11:08, martijn.list <martijn.list@gmail.com> wrote:
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
That doesn't make much sense.. Broken pipe means that the other side disconnected the socket. A read wouldn't disconnect a socket no matter when it was done. I'd say that some bug in your code is causing the socket to be disconnected too early. stracing it might be helpful.
Oh, and apparently I remembered wrong and the passdb/userdb dict lookups are done via auth-workers, so you'd be getting a connection from each auth-worker. It would be just one connection per auth-worker process though. But they're disconnecting immediately after having finished the pending lookups.