NoSuchTransaction
in reactive mongodb client when working with transactions
#4804
Labels
status: waiting-for-triage
An issue we've not yet triaged
Setup
Spring Boot
3.3.4
withorg.springframework.boot:spring-boot-starter-webflux
andorg.springframework.boot:spring-boot-starter-data-mongodb-reactive
. MongoDB version is6.0.18
.MongoDB Config
Reactive mongo client is configured in configuration to activate transactional feature in mongo templates:
Docker Setup
For local and integration testing a mongodb is configured using docker compose. The db is configured as single node replica set. The here mentioned init script just runs
rs.initiate(...)
to register replica set. In the application properties the according connection string is set withmongodb://localhost:27017/?replicaSet=rs0
.Application Code
I have an endpoint
PUT /foo
which should update multiple entries in a single collection. This update should be transactional. Before updating the entries, all entries are fetched by ids and some validation is done before updating the entries:Integration Tests
To test the transactional behavior I wrote a Spring Boot integration test. I leveraged coroutines to fire 100 requests concurrently against the endpoint using the web test client to make sure there are no side-effects.
Unfortunately, I see side effects in the transactional behavior. On a random basis there is a
MongoTransactionException
thrown withNoSuchTransaction
instead of the expectedDataIntegrityViolationException
. Therefore this test fails and I cannot explain why that is. Can anybody help?The text was updated successfully, but these errors were encountered: