cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Resolve deadlocks in CAP Node.JS app

carlonnheim
Participant
0 Likes
2,576

Hi,

I am having issues with deadlocks when processing Event Mesh messages in a CAP Node.js application. We have the following context:

  • A single queue is receiving frequent messages
  • The queue emits 10 concurrent messages to increase throughput
  • The queue will retry each message 3 times, since our scenarios often have transient errors

This runs fine most of the time, but I run into deadlocks if/when the error rate increases. We are in essence doing this:

messaging.on('sometopic', async (msg) => {
//... our stuff which locks certain db resources and may throw errors
//... we do not make any "cds.tx" handling or so (done by the framework to our understanding)
});

We can see the locks in the database monitor when it stalls, looking like this:

What surprises me is that there is an idle session which blocks the ones trying to lock an actual resource. I am suspecting that I am somehow preventing one message processing attempt from cleaning up before the retry comes in and tries to lock the same resources.

Is there a way to trace from e.g. the Logical Connection ID (marked 239984 in the scenario above) to which cds transaction it is that started it?

Hoping somebody has advice on how to isolate the root cause in this situation.

Thanks!

//Carl

Accepted Solutions (0)

Answers (0)