APM Java Agent error java.lang.StackOverflowError TemplateInputException

Java: 1.8
APM Server : 6.3
APM Agent : 0.6.2

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.StackOverflowError
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:982)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
        ........
    Caused by: java.lang.StackOverflowError
    	at java.util.concurrent.atomic.AtomicLongArray.get(AtomicLongArray.java:112)
    	at co.elastic.apm.shaded.jctools.queues.atomic.SequencedAtomicReferenceArrayQueue.lvSequence(SequencedAtomicReferenceArrayQueue.java:52)
    	at co.elastic.apm.shaded.jctools.queues.atomic.MpmcAtomicArrayQueue.poll(MpmcAtomicArrayQueue.java:206)
    	at co.elastic.apm.objectpool.impl.QueueBasedObjectPool.tryCreateInstance(QueueBasedObjectPool.java:55)
    	at co.elastic.apm.objectpool.impl.AbstractObjectPool.createInstance(AbstractObjectPool.java:39)
    	at co.elastic.apm.impl.ElasticApmTracer.createRealSpan(ElasticApmTracer.java:203)
    	at co.elastic.apm.impl.ElasticApmTracer.startManualSpan(ElasticApmTracer.java:185)
    	at co.elastic.apm.impl.ElasticApmTracer.startSpan(ElasticApmTracer.java:170)
    	at co.elastic.apm.jdbc.JdbcHelper.createJdbcSpan(JdbcHelper.java:82)
    	at co.elastic.apm.jdbc.StatementInstrumentation.onBeforeExecute(StatementInstrumentation.java:62)
        ........
    java.net.ConnectException: Connection refused (Connection refused)
    	at java.net.PlainSocketImpl.socketConnect(Native Method)
    	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    	at java.net.Socket.connect(Socket.java:589)
    	at java.net.Socket.connect(Socket.java:538)
    	at java.net.Socket.<init>(Socket.java:434)
    	at java.net.Socket.<init>(Socket.java:286)
        ...............
    2018-08-27 16:59:46.383 ERROR 16343 --- [ XNIO-2 task-23] 92 org.thymeleaf.TemplateEngine             :  [THYMELEAF][XNIO-2 task-23] Exception processing template "api/staffolive/refresh": Error resolving template "api/staffolive/refresh", template might not exist or might not be accessible by any of the configured Template Resolvers
    org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "api/staffolive/refresh", template might not exist or might not be accessible by any of the configured Template Resolvers
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
       .................
    Caused by: org.thymeleaf.exceptions.TemplateInputException: Error resolving template "api/staffolive/refresh", template might not exist or might not be accessible by any of the configured Template Resolvers
    	at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:246)
    	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104)
    	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1060)
    	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1011)
    	at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335)
    	at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:190)
    	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286)
    	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    	... 99 more

Hi and thanks for your error report!

Could you add some more lines for Caused by: java.lang.StackOverflowError?

Does that happen every time or just occasionally?

I think this error is already resolved in the current development snapshot. Could you try that out?

Cheers,
Felix

` Caused by: java.lang.StackOverflowError Repeat after 200 times.
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1305)
at com.mysql.jdbc.DatabaseMetaData.getUserName(DatabaseMetaData.java:6274)
at co.elastic.apm.jdbc.JdbcHelper.getConnectionMetaData(JdbcHelper.java:110)
at co.elastic.apm.jdbc.JdbcHelper.createJdbcSpan(JdbcHelper.java:93)
at co.elastic.apm.jdbc.StatementInstrumentation.onBeforeExecute(StatementInstrumentation.java:62)

Did you try the snapshot build? I should be fixed there.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.