[SERVER-69772] MongoDB 6.0: Invalid UTF-8 string in BSON document when adding an arbiter Created: 16/Sep/22  Updated: 18/Oct/22  Resolved: 18/Oct/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.0.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jordi Font Saballs Assignee: Chris Kelly
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Steps To Reproduce:

rs.initiate()
rs.add("172.26.251.51:27017")
rs.addArb("172.26.251.61:27017")  
rs.status()

Participants:

 Description   

I have an installation of 3 MongoDBs which should act as a replica set, two of them data bearing nodes and one an arbiter. I have already configured both data bearing nodes but I have a problem configuring the arbiter.

> rs.addArb("172.26.251.61:27017")
{
  ok: 1,
  '$clusterTime': {
    clusterTime: Timestamp({ t: 1663326365, i: 2 }),
    signature: {
      hash: Binary(Buffer.from("0000000000000000000000000000000000000000", "hex"), 0),
      keyId: Long("0")
    }
  },
  operationTime: Timestamp({ t: 1663326365, i: 2 })
}

Then I check and I get an error:

rs.status()
BSONError: Invalid UTF-8 string in BSON document

If I remove the arbiter `rs.remove("172.26.251.61:27017")` then `rs.status()` works properly again:



 Comments   
Comment by Chris Kelly [ 18/Oct/22 ]

We haven’t heard back from you for some time, so I’m going to close this ticket. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Comment by Chris Kelly [ 03/Oct/22 ]

Jordi,

We still need additional information to diagnose the problem. If this is still an issue for you, would you please clarify your configuration settings for the arbiter and supply the logs?

Christopher

Comment by Chris Kelly [ 16/Sep/22 ]

Hi Jordi,

Thanks for your report. I do not observe this behavior when attempting to reproduce this following the steps shown in the documentation for adding arbiters to a replica set.

Could you clarify your configuration settings for the arbiter? Also, supplying the logs of both nodes when you attempt to do this would be helpful:

For each node in the replica set spanning a time period that includes the incident, would you please archive (tar or zip) and upload to the ticket:

  • the mongod logs
  • the $dbpath/diagnostic.data directory (the contents are described here)

 

In my case, I attempted:

1) Initialize a replica set

2) Starting another mongod with this configuration and adding it to the replica set (from the docs linked above)

mongod --port 27018 --dbpath /var/lib/mongodb/arb --replSet rs --bind_ip localhost,<hostname(s)|ip address(es)>mongod --port 27030 --dbpath /var/lib/mongodb/arb --replSet rs --bind_ip localhost,<hostname(s)|ip address(es)>

3) Connect to primary node with mongosh, and add the new membersrun rs.addArb():

rs.add("localhost:27018")rs.addArb("localhost:27030")

4) Originally, I get an error because I had to modify my default write concern. I changed it to w:1 for now.

MongoServerError: BSON field 'setDefaultRWConcern.defaultWriteConcern' is the wrong type 'int', expected type 'object'
replset [direct: primary] test> db.adminCommand({setDefaultRWConcern: 1,defaultWriteConcern:{w:1}})

5) rs.status() shows my arbiter.

    {
      _id: 3,
      name: 'localhost:27030',
      health: 1,
      state: 7,
      stateStr: 'ARBITER',
      uptime: 6,
      lastHeartbeat: ISODate("2022-09-16T18:00:25.008Z"),
      lastHeartbeatRecv: ISODate("2022-09-16T18:00:25.383Z"),
      pingMs: Long("0"),
      lastHeartbeatMessage: '',
      syncSourceHost: '',
      syncSourceId: -1,
      infoMessage: '',
      configVersion: 2,
      configTerm: 1
    }

Christopher

Generated at Thu Feb 08 06:14:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.