couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Couch User (JIRA)" <>
Subject [jira] [Created] (COUCHDB-2545) couchdb fails intermittently on startup on fresh system (reproducible)
Date Fri, 16 Jan 2015 14:02:35 GMT
Couch User created COUCHDB-2545:

             Summary: couchdb fails intermittently on startup on fresh system (reproducible)

                 Key: COUCHDB-2545
             Project: CouchDB
          Issue Type: Bug
      Security Level: public (Regular issues)
            Reporter: Couch User

using couchdb 1.5.0 on ubuntu 14.04.
Issue can be reasonably reliably reproduced with the following sequence.

create a custom override configuration as follows (couchdb.ini)
database_dir = .
view_index_dir = .
uri_file = couchdb.uri

port = 5984
bind_address =

level = debug
file = couchdb.log

run this approximate sequence of shell in a loop as a non-root / unprivileged user. note will
require permission to /etc/couchdb/local.d
normally it will take less than 5 runs of the following script to fail.

# -- start script --
# clean files from previous run (if any)
rm -f _replicator.couch _users.couch couchdb.log couchdb.stderr couchdb.stdout
>/dev/null 2>&1 || true

# start couch in cwd (as per couchdb.ini)
couchdb -b -a couchdb.ini -p

# wait for couchdb to produce & populate its pidfile
# usable implementation of wait_pidfile at the end of this issue

# basic check that is running
# this is where we'll fail because couchdb will frequently crash after writing the pidfile.
kill - 0 `cat` || exit 1

# stop couchdb if it didn't fail this time.
couchdb -d -a couchdb.ini -p couchdb.ini

# --end script--

Here's the erlang backtrace I end up with when it does terminate.  If I was speculating I'd
guess that compaction was running on the database while it was still being initialized.  There
doesn't seem to be a real need to run compaction during initialization since the database
should in theory be empty anyway...

Further if I disable the compaction daemon through /etc/couchdb/default.ini by removing the
entry from [daemon] couchdb no longer fails.

[Thu, 15 Jan 2015 22:36:56 GMT] [error] [<0.151.0>] ** Generic server couch_compaction_daemon
** Last message in was {'EXIT',<0.152.0>,
** When Server state == {state,<0.152.0>}
** Reason for termination ==
** {compaction_loop_died,

[Thu, 15 Jan 2015 22:36:56 GMT] [error] [<0.151.0>] {error_report,<0.31.0>,

-- truncated, if the entire backtrace is required let me know I'll send the couchdb.log by

# note as a side, couchdb -s doesn't seem to pay attention to or care about -p so don't try
to use it.

wait_pidfile() {
        while [ $_interval -gt 0 ]; do
                pid=$(cat "$1" 2>/dev/null)
                if [ -z $pid ]; then
                        _interval=`expr $_interval - 1`
                        sleep 1
        [ -n $pid ] && echo -n $pid || false

thanks for looking into this

This message was sent by Atlassian JIRA

View raw message