Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

After stepping down the primary node, queries failed with error 16550: "not authorized for query on test.users" #247

@tanpeter

Description

@tanpeter

I'm using moped 1.5.1, mongodb 2.4.8

Steps to reproduce:

  1. Have a replica set of 3 nodes
  2. A script that does one insert, and one query every couple seconds in the loop (using eventual consistency)
  3. While the script is running, on mongo shell, do rs0:PRIMARY> rs.stepDown(). As the result, one of the secondary nodes becomes primary and the ex-primary becomes a secondary.
  4. Before the replica set information gets refreshed, insert operations still go the ex-primary and get dropped (no new doc created).
  5. After the replica set information refreshes, new docs are now created.
  6. However the query operation starts failing with this error:
#<Moped::Errors::QueryFailure: The operation: #<Moped::Protocol::Query
  @length=61
  @request_id=98
  @response_to=0
  @op_code=2004
  @flags=[:slave_ok]
  @full_collection_name="test.users"
  @skip=0
  @limit=-1
  @selector={:_id=>"52ba15d345f540523400007a"}
  @fields=nil>
failed with error 16550: "not authorized for query on test.users"
  1. On the ex-primary, now-secondary mongodb logs, similar error:
[conn327] assertion 16550 not authorized for query on test.users ns:test.users query:{ _id: ObjectId('52ba0b3c45f5406fd9000086') }
  1. The error only happens on the ex-primary, the other secondary node is fine.
  2. The error won't go away until either I restart the script, or I restart the ex-primary node.

It seems to me that moped continues to use the connection to the ex-primary node for querying purpose now but mongodb requires reauth (or even reconnect, that's what mongo shell does).

Thanks in advance for looking into the issue.

-Peter

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions