Wowza Community

Truncated exception stack traces

Hello,

We’re actively developing a wowza application and at times we’re having trouble finding out where our code is failing by throwing an exception. The default configuration for logging on WowzaStreamingEngine doesn’t provide much help as stack traces get truncated. Here’s an example:

ERROR	server	comment	2015-09-10	14:47:34	-	-	-	-	-	41.252	-	-	-	-	-	-	-	-	invoke(onConnect): java.lang.reflect.InvocationTargetException|at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)|at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)|at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)|at java.lang.reflect.Method.invoke(Method.java:483)|at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:369)|
ERROR	server	comment	2015-09-10	14:47:34	-	-	-	-	-	41.306	-	-	-	-	-	-	-	-	invoke(onConnect): java.lang.reflect.InvocationTargetException|at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)|at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)|at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)|at java.lang.reflect.Method.invoke(Method.java:483)|at com.wowza.wms.module.ModuleFunction.invoke(ModuleFunction.java:369)|

As you can see, the logs are missing the root cause of the exception. Is there any way we can configure the logs so we get the full stack trace? I hate having to surround all code in Wowza’s entry points with try catches just to make sure we can pinpoint where exceptions originate from.

Thank you,

Ionut

Hello there and welcome tot he Wowza support forum.

You can use the instruction here, How to take a Java stack trace to get the stack trace. You may have to use the jstack method as JMX may be unresponsive.

Salvadore

Hello, Salvadore,

Thank you for the reply.

I’m not looking to get a thread dump. The excerpt is from the Wowza production log. Something in the onConnect method has thrown an exception that Wowza caught for us but it’s not printing the full stack trace of the exception in the logs.

We were expecting something like this - a full stack trace:

javax.servlet.ServletException: Something bad happened
    at com.example.myproject.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:60)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.example.myproject.ExceptionHandlerFilter.doFilter(ExceptionHandlerFilter.java:28)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.example.myproject.OutputBufferFilter.doFilter(OutputBufferFilter.java:33)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.example.myproject.MyProjectServletException
    at com.example.myproject.MyServlet.doPost(MyServlet.java:169)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.example.myproject.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:30)
    ... 27 more
Caused by: org.hibernate.exception.ConstraintViolationException: could not insert: [com.example.myproject.MyEntity]
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:64)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2329)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2822)

I suspect that the x-comment field of com.wowza.wms.logging.ECLFPatternLayout has a limit on character count which truncates the stack trace. I think this makes printing exception stack traces a lot less useful than they could be as the only info we get is that something was wrong but not where.

Any ideas on this?

Thanks again for your time!