AnsweredAssumed Answered

Controlling Extremely Large Exception Stack Traces

Question asked by codetom on Dec 7, 2011
Latest reply on Dec 13, 2011 by trademak
Hi all,

We're using Activiti heavily in my organization, and I wanted to request help from the community on an issue that is currently plaguing us right now: extremely long stack traces.  I know it sounds ridiculous, but it's a serious problem.  For a single issue (say a database insertion error, invalid column), we might get 3500 lines in that 1 stack trace, between the trace itself and the various "Caused by" statements.

Allow me to explain … for our purposes, we might have 5-10 nested process flows within a primary process flow.  Some of those process flows are also tagged as "Multi-Instance" flows as well … thus leading to some additional flows.  In addition to that, we might have up to 20 individual ServiceTask or ScriptTask elements in a flow.  Each ServiceTask may be calling one or more DAO operations to perform database CRUD operations.  So, you can imagine that if one of those DAO operations fails with an exception that is then propagated into the BPMN flow … we're in for a world of hurt.

I know there might be a couple easy answers to this:
  1. Why are you propagating the exception into the BPMN flow?  Why not trap the exception before it reaches back to the BPMN flow?  The answer is that Spring / MyBatis transaction management operate based on thrown Exceptions if you want to use it out of the box.  Manually managing transaction creation and roll back in MyBatis can be a major pain.  In our case, we want to make sure we can roll back Spring-initiated transaction that might occur in the ServiceTasks.
  2. Ignore the extraneous logs … you can always find the root of the problem.  While its true that when looking at the "Caused by" we get the error, but the sheer amount of log spam generated by the errors occurring in the first place if overwhelming all of our otherwise useful log messaging, and is drastically reducing our capability to debug issues quickly as a result.  One 3000 line trace may not be an issue, but throw 100 users pounding away at the system and you start having some major issues.

If you have experience with Activiti, its exception handling strategy or logging strategy, and you can share information / point me in the right direction .. or if you've dealt with similar issues yourself .. I would love to hear about it.

Thanks in advance,