You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2019/06/19 01:34:02 UTC

[GitHub] [couchdb] iilyak commented on issue #1600: Sporadic errors on /_all_docs with Cookie auth and system databases

iilyak commented on issue #1600: Sporadic errors on /_all_docs with Cookie auth and system databases
URL: https://github.com/apache/couchdb/issues/1600#issuecomment-503371250
 
 
   > @wohali Another repro on this: saw it when enabling maintenance mode on a node.
   
   # Theory : Some update events are not delivered when node is in MM.
   
   The `chttpd_auth_cache` server listens for changes to users database. So it can [evict](https://github.com/apache/couchdb/blob/master/src/chttpd/src/chttpd_auth_cache.erl#L165) updated entries from the cache. The changes listener is implemented using `fabric:changes/4`. The `fabric:changes` [iterates](https://github.com/apache/couchdb/blob/master/src/fabric/src/fabric_db_update_listener.erl#L70:L73) over all shards for users database and calls [`start_update_notifier/1`](https://github.com/apache/couchdb/blob/master/src/fabric/src/fabric_db_update_listener.erl#L76) for every shard. The [`start_update_notifier/1`](https://github.com/apache/couchdb/blob/master/src/fabric/src/fabric_db_update_listener.erl#L76:L81) is implemented as follows:
   ```
   start_update_notifier(DbNames) ->
       {Caller, Ref} = get(rexi_from),
       Notify = config:get("couchdb", "maintenance_mode", "false") /= "true",
       State = #cb_state{client_pid = Caller, client_ref = Ref, notify = Notify},
       Options = [{parent, Caller}, {dbnames, DbNames}],
       couch_event:listen(?MODULE, handle_db_event, State, Options).
   ```
   
   The notification about a database update is not send if node is in the maintenance mode. The failure mode is as follows:
   
   - put node in the MM
   - cause changes listener restart (it would be restarted automatically after config:get("httpd", "changes_timeout", "60000")) milliseconds.
   - update user 
   - we would miss db_update event (because Notify would be false)
   - the ets_lru cache backing chttpd_auth_cache would still be holding old entry.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services