Write Ops Are Persisted But Sometimes Driver Function Does Not Return

My database queries all work fine but in production with high load I get this sporadic issue: Write operations – updateOne mostly, also insert – get persisted in the database but the node.js mongodb driver function does not return / the returned Promise is neither resolved nor rejected.

I activated command monitoring and can confirm that ‘commandStarted’ events are fired but neither ‘commandSucceeded’ nor ‘commandFailed’ events appear for these cases. I checked the state of my documents in the db and can confirm that the write operations were successfully persisted – the documents contains the updated info as expected.

I checked the node.js driver code – mongodb package – and can see that not much is happening between the ‘commandStarted’ event and the ‘commandSucceeded’ and ‘commandFailed’ events. Essentially the message is compressed and sent via a socket. So unless I missed something, this means that the database is simply not responding.

I am using MongoDB Atlas with MongoDB v7.0 at the moment but I observed the same issue a week ago when I was still using MongoDB v4.0 hosted by a 3rd party cloud provider. I downloaded the logs from MongoDB Atlas hoping to find some info about these write ops but unfortunately nothing seems to be in there. And Atlas does not allow me to increase the log level with ‘db.setLogLevel(1)’.

Does anyone have any ideas for how I could debug this further? I am unfortunately out of ideas for how I could understand better what is happening. Thank you very much!

I found out that this issue is caused by the node.js mongodb driver version 6. I do not observe this issue with version 5. Hence I downgraded until the bug is fixed that I reported here:
https://jira.mongodb.org/browse/NODE-6166