I'll attach an example reproduction case, but in my case when using a session for a transaction the logs show the following:
So in the above case. Transaction 166, started and was committed before startTransaction 167 started but using the session with txn 167 failed.
Steps to reproduce the issue:
- unarchive mongodb-session.problem.tgz
- mvn clean package
- java -jar target/mongodb-session-problem-1.0-SNAPSHOT-jar-with-dependencies.jar &> logs.txt
This example should also be reproducible using intellij.
There is a sync example as well (change the pom.xml main class) which does not have this issue.