Skip to content

[Bug]: couch_peruser process exits immediately, restarts every 5 seconds #6086

Description

@stuartlangridge

Version

3.5.1

Describe the problem you're encountering

with [couch_peruser] enable=true in .ini config, the couch_peruser process was not working (that is: userdb-(hash) databases were not being created when new users were added).
The logs showed lines such as the following (with loglevel debug):

2026-08-02T00:30:09.118Z
[error] 2026-08-02T00:30:09.118526Z nonode@nohost <0.404.0> -------- Supervisor couch_peruser_sup had child couch_peruser started with couch_peruser:start_link() at <0.14666123.0> exit with reason normal in context child_terminated
2026-08-02T00:30:09.153Z
[debug] 2026-08-02T00:30:09.153616Z nonode@nohost <0.14666938.0> -------- peruser: skipping, cluster unstable shards/80000000-ffffffff/_users.1754906410/org.couchdb.user:b03c99dc-f0a1-70bc-5be7-d20c4521814a

the couch_peruser process was restarted by the supervisor every five seconds, and then immediately exited with the "cluster unstable" error messages.

Expected Behaviour

couch_peruser should be started at server startup and then stay running without exiting.

Steps to Reproduce

It is hard to say how to reproduce this because we're not actually sure what the problem was. But I can explain how we fixed it, which was to identify all users in _users who have been deleted (that is, are tombstones with deleted: true) but not purged, and then purge them.

The problem may have been caused by there being deleted+unpurged users at all. However, we had a normal user account called phpadmin which was deleted (but not purged) and then a server admin account called phpadmin (same name) was created in the ini file (so there were, by some measures, two accounts with the same name). The _users/org.couchdb.user:phpadmin document is one of those that was deleted:true. Purging all the deleted:true _users users fixed the problem, and this included the phpadmin account. My speculation is the "duplicated" account was the problem, but this is speculation only.

Your Environment

couchdb 3.5.2 from the dockerhub official docker image running in AWS ECS

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions