-
Type: Bug
-
Resolution: Gone away
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.6.4
-
Component/s: None
-
None
Environment (required to reproduce the issue)
- Node.js driver 3.6.4
- MongoDB 4.4 sharded cluster
- URI includes "maxStalenessSeconds=90" and "readPreference=secondary"
- application is running queries via mongos that end up on a shard X
- shard X is a 3-member replica set, and one of the members goes down
If any of these conditions is not met, the error does not happen. In particular, the maxStalenessSeconds option must be present, and the MongoDB version must be 4.4, and a secondary must be down.
If the conditions are met, the following error occurs on the client side:
MongoError: Encountered non-retryable error during query :: caused by :: Incompatible wire version
The following sample program demonstrates the issue, when run against a MongoDB 4.4 sharded cluster, connected to the mongos. Start the program, and while it's running, take down one of the secondaries of the primary shard for the "test" database. The error should be seen immediately. As the shard still has a primary and a secondary, it should be able to handle secondary queries.
const { MongoClient } = require("mongodb"); const uri = "mongodb://admin:tester@repro/?retryWrites=true&w=majority&readPreference=secondary&maxStalenessSeconds=90"; const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true }); async function run() { try { await client.connect(); const database = client.db('test'); const collection = database.collection('bar'); for (i=0; i<10000; i++) { const doc = {a: 42+i}; await collection.insertOne(doc); const doc2 = await collection.findOne(doc); console.log(doc2); } } catch(err) { console.error(`something went wrong: ${err}`); } finally { await client.close(); } } run().catch(console.dir);
- depends on
-
SERVER-57136 Incompatible wire version error on secondary shutdown in sharded cluster
- Closed