[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#8504) LDMB: Return EPIPE from mdb_env_copyfd2 instead abort on SIGPIPE

On 27/09/16 22:14, lmb@cloudflare.com wrote:
>On 26 September 2016 at 20:48, Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no> wrote:
>> I think we can skip sigwait() too since the thread will exit when done.
>> (...)
> That's what my initial patch did. At least on OS X this leads to the
> process receiving SIGPIPE and dying.

OK.  I've put a fixed version including that comment in branch
"mdb/its8504-sigpipe" @ <git://git.uio.no/u/hbf/openldap.git>.
We can squash the commits later:

Never clear mc_error, we'd lose failure in the other thread.
It's not mutex-protected, which is OK: If both threads set it,
we'll get one of the errors. LMDB already expects atomic int.

And.. duh, we've forgotten mdb_copy without MDB_CP_COMPACT.
I'll do it later if nobody beats me to it.
Test:  Comment out SIGPIPE in mdb_copy.c, then run

   bash$ (sleep 1; ./mdb_copy testdb; echo exit $? >&2) | true
   exit 141

Exit values >= 128 are aborts from signals.