BUG?: Dsync over piped process (DSYNC_RUN_TYPE_CMD): EPIPE if X (done) is received in another write after F (finish)

J. Nick Koston nick at cpanel.net
Fri May 20 04:12:46 UTC 2016


Hi Timo,

The below solved the problem for me as far as I can tell

I was getting a EPIPE about 1:30 dsync runs over the socket. I have received 0 in 10000 runs with this change.
https://github.com/dovecot/core/pull/10 <https://github.com/dovecot/core/pull/10>

You know the code much better then I do so you might have a better way?


Also I have a commit to address the constant warnings when the prefix is set to INBOX. with the
quota_quota plugin here:
https://github.com/dovecot/core/pull/7 <https://github.com/dovecot/core/pull/7>

Thanks
-Nick

Timo Sirainen tss at iki.fi  <mailto:dovecot%40dovecot.org?Subject=Re%3A%20BUG%3F%3A%20Dsync%20over%20piped%20process%20%28DSYNC_RUN_TYPE_CMD%29%3A%20EPIPE%20if%20X%0A%09%28done%29%20is%20received%20in%20another%20write%20after%20F%20%28finish%29&In-Reply-To=%3CA5A2C866-9A65-439B-B232-231202B94525%40iki.fi%3E>Thu May 19 23:15:18 UTC 2016
> 
> On 19 May 2016, at 03:54, J. Nick Koston <nick at cpanel.net <http://dovecot.org/cgi-bin/mailman/listinfo/dovecot>> wrote:
> > 
> > Hi,
> > 
> > It appears that dsync closes the file handle once it gets the F (finish) response even if it hasn’t received the X (done) response. 
> > If the X (done) response gets delivered in another write this will generate EPIPE in the connected process.
> > 
> > This is much easier to replicate over SSL, however the trace is provided without SSL since its easier to see whats going on.
> 
> Do you see this as causing some problem? I think this is intentional. The F(inish) tells the final response whether everything was OK or not, so all the work is done after that. The 'X' is described in code as:
> 
> 		/* notify remote that we're closing. this is mainly to avoid
> 		   "read() failed: EOF" errors on failing dsyncs */
> 		o_stream_nsend_str(ibc->output,
> 			t_strdup_printf("%c\n", items[ITEM_DONE].chr));
> 
> and on the receiving side:
> 
> 	if (line[0] == items[ITEM_DONE].chr) {
> 		/* remote cleanly closed the connection, possibly because of
> 		   some failure (which it should have logged). we don't want to
> 		   log any stream errors anyway after this. */
> 		dsync_ibc_stream_stop(ibc);
> 		return DSYNC_IBC_RECV_RET_TRYAGAIN;
> 	}
> 
> So I think it only matters in error handling.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3569 bytes
Desc: not available
URL: <http://dovecot.org/pipermail/dovecot/attachments/20160519/9cb02728/attachment.p7s>


More information about the dovecot mailing list