Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix couch server race condition #1596
There are two separate bugs here being fixed. The first was in
The second bug has to deal with a race between deletions and opens as well as the state of couch_server's mailbox. There's a very specific set of operations that have to happen in a particular order to trigger this bug:
The underlying issue here is that the deletion request clears the
The fix was just to ensure that the opener pid in the
The second of three commits adds a failing test case that is fixed by the third commit.
The issue is reproducible with this script (in a remsh):
When run like this for example:
It might help to have a few dbs open and some activity, like say a bunch of replication jobs running as well.
The node would crash and possibly restart leaving something like this in the log:
Awesome find and fix @davisp!
Checked that the fuzzer script that could reproduce the script can't reproduce it any more.
======================== EUnit ======================== module 'couch_server_tests' Test for proper deletion of db file Application crypto was left running! rename couch_server_tests:69: should_rename_on_delete...[0.003 s] ok [done in 0.006 s] delete couch_server_tests:84: should_delete...[0.003 s] ok [done in 0.006 s] [os_mon] cpu supervisor port (cpu_sup): Erlang has closed [done in 0.084 s] couch_server_tests: bad_engine_option_test_...ok [os_mon] cpu supervisor port (cpu_sup): Erlang has closed couch_server_tests: make_interleaved_requests...[0.327 s] ok [os_mon] cpu supervisor port (cpu_sup): Erlang has closed [done in 2.507 s] ======================================================= All 4 tests passed.