We used an application named monstache with mongo-go-driver v1.4.1 to watch change streams from replica ret with mongods of v4.4.0. And the whole system works well for a few weeks but the primary mongod restarted frequently after we started to use transaction with java-go-driver.
We tried the following conditions to check the cause:
- when the server restarted frequently, we check the connection status between host:post and not this
- We checked and ensured that the wach apis of mongo-go-driver are used correctly
- The mongo processes are started with systemd and we add the remommended ulimits in the systemd service. And we created 500 mongoClient instances and ran our transaction unit tests with monstache running but the mongo didn't restart.
However sometimes the mongod restarted all of a sudden.
Below are the logs and the key words are "SERVER RESTARTED" and the "ctx":"connXXX" which is generated by mongo-go-driver used by monstache and the printed BACKTRACE and Invariant failure.