eventuate-tram/eventuate-tram-sagas

build 176 randomly failed

dartartem opened this issue · 0 comments

Build failed: https://app.circleci.com/pipelines/github/eventuate-tram/eventuate-tram-sagas/63/workflows/686e4476-9603-4809-a0b1-e23b67eb8b9f/jobs/176
After restart passed.

Locally is not reproducible.

I researched logs and debugged failed test and found that there 2 saga managers in the same time:

2021-02-17 15:12:10.262 DEBUG 10221 --- [pool-1-thread-2] i.e.t.s.orchestration.SagaManagerImpl    : handle message invoked io.eventuate.tram.messaging.common.MessageImpl@274a0f74[payload={},headers={commandreply_saga_id=00000177b08c70e0-5acbf80076950000, DATE=Wed, 17 Feb 2021 15:12:10 GMT, reply_outcome-type=SUCCESS, commandreply__destination=customerService, commandreply_reply_to=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.createorder.LocalCreateOrderSaga-reply, commandreply_type=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.participants.ReserveCreditCommand, DESTINATION=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.createorder.LocalCreateOrderSaga-reply, commandreply_saga_type=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.createorder.LocalCreateOrderSaga, reply_type=io.eventuate.examples.tram.sagas.ordersandcustomers.customers.service.CustomerCreditReserved, reply_to_message_id=00000177b08c7142-5acbf80076950000, ID=00000177b08c71fb-5acbf80076950000}]
2021-02-17 15:12:10.302 DEBUG 10221 --- [pool-1-thread-3] i.e.t.s.orchestration.SagaManagerImpl    : handle message invoked io.eventuate.tram.messaging.common.MessageImpl@274a0f74[payload={},headers={commandreply_saga_id=00000177b08c70e0-5acbf80076950000, DATE=Wed, 17 Feb 2021 15:12:10 GMT, reply_outcome-type=SUCCESS, commandreply__destination=customerService, commandreply_reply_to=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.createorder.LocalCreateOrderSaga-reply, commandreply_type=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.participants.ReserveCreditCommand, DESTINATION=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.createorder.LocalCreateOrderSaga-reply, commandreply_saga_type=io.eventuate.examples.tram.sagas.ordersandcustomers.orders.sagas.createorder.LocalCreateOrderSaga, reply_type=io.eventuate.examples.tram.sagas.ordersandcustomers.customers.service.CustomerCreditReserved, reply_to_message_id=00000177b08c7142-5acbf80076950000, ID=00000177b08c71fb-5acbf80076950000}]

2 identical message handlings from different threads. So, it seems it is concurrency issue.

I found that there 2 saga managers.

  1. Created by SagaInstanceFactory

  1. Created explicitly in configuration:

public SagaManager<LocalCreateOrderSagaData> localCreateOrderSagaManager(Saga<LocalCreateOrderSagaData> saga,

Since SagaInstanceFactory is newer, second place is redundant.