elastic / apm-agent-java

https://www.elastic.co/guide/en/apm/agent/java/current/index.html
Apache License 2.0
562 stars 320 forks source link

Agent crashes when transaction_max_spans=1 #3642

Closed jackshirazi closed 1 month ago

jackshirazi commented 1 month ago

Describe the bug

https://discuss.elastic.co/t/app-agent-blocking-application-startup-with-activation-leak-error/359708

Steps to reproduce

set transaction_max_spans=1

Expected behavior

no crash

Debug logs

taken from the discuss thread ``` 2024-05-16 11:11:02,526 [http-nio-8080-exec-1] WARN co.elastic.apm.agent.impl.transaction.Span - Max spans (1) for transaction '' 00-f20cdf84e12b32f0be889aea2cadc9ba-37559b8798182bac-01 (7fa9ca81) has been reached. For this transaction and possibly others, further spans will be dropped. See config param 'transaction_max_spans'. 2024-05-16 11:11:02,430 [http-nio-8080-exec-2] ERROR co.elastic.apm.agent.impl.ActiveStack - Activation stack depth reached its maximum - 1. This is likely related to activation leak. Current transaction: '' 00-161a1f97d7527cb39229d18fb82c9dcd-14c3825251226a79-01 (6554993d) java.lang.Throwable: Stack of threshold-crossing activation: at co.elastic.apm.agent.impl.ActiveStack.activate(ActiveStack.java:89) [elastic-apm-agent.jar:1.47.1] at co.elastic.apm.agent.impl.ElasticApmTracer.activate(ElasticApmTracer.java:865) [elastic-apm-agent.jar:1.47.1] at co.elastic.apm.agent.impl.transaction.ElasticContext.activate(ElasticContext.java:63) [elastic-apm-agent.jar:1.47.1] at co.elastic.apm.agent.impl.transaction.ElasticContext.activate(ElasticContext.java:32) [elastic-apm-agent.jar:1.47.1] at co.elastic.apm.agent.redis.RedisSpanUtils.createRedisSpan(RedisSpanUtils.java:40) [elastic-apm-agent.jar:1.47.1] at co.elastic.apm.agent.jedis.SendCommandAdvice.sendCommandEntry(SendCommandAdvice.java:35) [elastic-apm-agent.jar:?] at redis.clients.jedis.Connection.sendCommand(Connection.java:95) [jedis-2.8.1.jar:?] at redis.clients.jedis.BinaryClient.ping(BinaryClient.java:93) [jedis-2.8.1.jar:?] at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:105) [jedis-2.8.1.jar:?] ```