Activiti stack traces are huge. How to reduce? - performance

In our application, we're using Activiti and the issue is that in the log we're getting very large exception stack traces, a couple of hundreds of rows per exception.
Also, the huge stack trace doesn't give additional useful information, so there is no good reason for us to have it.
I'm sure everyone who uses Activiti encountered this issue. How can we reduce the stack traces' size?

Activiti uses slf4j, so one option is to use the logback binding and customize its output using the %ex layout option.
You can find more information in the following link:
Chapter 6: Layouts
The relevant options are copied below:
ex{depth}
exception{depth}
throwable{depth}
ex{depth, evaluator-1, ..., evaluator-n}
exception{depth, evaluator-1, ..., evaluator-n}
throwable{depth, evaluator-1, ..., evaluator-n}
Outputs the stack trace of the exception associated with the logging event, if any. By default the full stack trace will be output.
The throwable conversion word can followed by one of the following options:
short: prints the first line of the stack trace
full: prints the full stack trace
Any integer: prints the given number of lines of the stack trace
Examples
Conversion Pattern Result
%ex mainPackage.foo.bar.TestException: Houston we have a problem
at mainPackage.foo.bar.TestThrower.fire(TestThrower.java:22)
at mainPackage.foo.bar.TestThrower.readyToLaunch(TestThrower.java:17)
at mainPackage.ExceptionLauncher.main(ExceptionLauncher.java:38)
%ex{short} mainPackage.foo.bar.TestException: Houston we have a problem
at mainPackage.foo.bar.TestThrower.fire(TestThrower.java:22)
%ex{full} mainPackage.foo.bar.TestException: Houston we have a problem
at mainPackage.foo.bar.TestThrower.fire(TestThrower.java:22)
at mainPackage.foo.bar.TestThrower.readyToLaunch(TestThrower.java:17)
at mainPackage.ExceptionLauncher.main(ExceptionLauncher.java:38)
%ex{2} mainPackage.foo.bar.TestException: Houston we have a problem
at mainPackage.foo.bar.TestThrower.fire(TestThrower.java:22)
at mainPackage.foo.bar.TestThrower.readyToLaunch(TestThrower.java:17)

Related

GNAT Ada runtime Exception = message EXCEPTION_STACK_OVERFLOW

I'am trying to run my application after compiling it with AdaCores GPS (Gnat Programming Studio).
I get the run time error
Exception name: STORAGE_ERROR
Message: EXCEPTION_STACK_OVERFLOW
I get these run time errors despite setting the stack size in the binder options using
-d65535 (task stack size) and
-D65535 (secondary stack size)
(I also have tried 65535k on both as well as 655m).
The application runs well when compiling it with the Aonix Object Ada compiler. In the Aonix compiler I set the
- stack size to 65535,
- the secondary stack size to 65535
- and the Task stack size to 46345.
My main aim is to port the application to the GNAT Ada compiler.
I notice -d sets the task stack size and -D the secondary stack size but I can't see where to set the main stack size, and I am assuming that this is the issue with the application, but please correct me if I am looking in the wrong direction.
Any pointers would be greatly appreciated appreciated.
Bearslumber
If the problem is indeed the main task, a workaround is to move the main procedure to the body of a helper task.
First, compile for debug (-g) (there may be other relevant options; posting wrong information is the fastest way to find them ;-) and you should get more information : the source line and file that raised the exception. Or a stack trace which you can analyze via addr2line.
That should help understand why it is raising...
Are you allocating hundreds of MB on the stack? I've got away with about 200MB in the past...
Is the raise within one of the container classes or part of the RTS?
Is the message actually misleading and a new() heap allocation failed? Other things than the stack can raise Storage_Error, and I'm not clear how or if the default handler distinguishes the cause...
We can't proceed further down this path without further information : edit it into the question and I'll take another look.
Setting stack size for the environment task is not directly possible within Gnat. It's part of gcc's interaction with the OS, and supposed to use the system's ulimit settings for the resulting executable (on Linux; other OS may vary)...
Unfortunately, around the gcc/gnat 4.5 timeframe I found evidence these were being ignored, though that may have been corrected, and I haven't revisited that problem.
I have seen Alex's answer posted elsewhere as a viable workround if the debug trace and ulimit settings don't provide the answer, or if you need to press on instead of spending time debugging. To keep the codebase clean, I would suggest a wrapper, simply creating the necessary task and calling your current main procedure. For Aonix you simply don't need to include the wrapper file in your build.

Thread dump in Objective C

I am new into objective c and I want to analyse my current thread.In java we using Using Thread Dumps. What is equivalent in objective C?
[NSThread callStackSymbols] will give you the call stack backtrace. Not sure if this is what you are looking for.
The reference is at https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSThread_Class/Reference/Reference.html
You can look at the stack in Xcode. The stack trace is always related to one point in time of execution. So you have to set a break point to the location you want to see the stack trace.
Xcode automatically switches to the debug navigator, if lldb stopped execution because of a break point. To switch manually click on the 6th symbol from the right at the top of the navigators.
To learn more about debugging refer this document.

Increase stack size in ECLiPSe/prolog/fd

We have to solve the liars problem in prolog, in several environments with constraints (ECLiPSe ic, ECLiPSe fd, SWI-prolog, GNU-prolog, NaxosSolver, etc.). I have used tail recursion (I think) and as many cuts as I could think of(that way I guess the resolution tree is not getting as big as it could be. If requested, I can post my code.
When the data number becomes 10000-50000, I receive a stack overflow in fd and ic in ECLiPSe and in SWI-prolog the program runs forever. So I would like to increase the size of the stack in ECLiPSe, but I can not see how.
I tried to write in the 1st line of my code this:
:-set_flag(local_stack_allocated, 512).
, but it says out of range.
See what eclipse says, which might be helpful:
* Overflow of the global/trail stack in spite of garbage collection!
You can use the "-g kBytes" (GLOBALSIZE) option to have a larger stack.
Peak sizes were: global stack 128832 kbytes, trail stack 5312 kbytes
First, from error message text I'm assuming that you mean ECLiPSe constraint logic programming system, not Eclipse IDE.
Second, how do you start ECLiPSe? How do you load your code into ECLiPSe?
Try this (you said you are on Windows):
Open command line from the folder where your ECLiPSe source file (say, 'myprogram.ecl') exists. For instructions look at this page: http://www.techsupportalert.com/content/how-open-windows-command-prompt-any-folder.htm
In the command line put eclipse -g 512000 and press ENTER.
Load your program using [myprogram]. (put name of your ECLiPSe source file instead of 'myprogram').
Execute queries as usual.
But I suspect that your program just runs forever and eats all memory, so all this probably won't help in the end.
EDIT. Updated instructions for TkECLiPSe:
In TkECLiPSe in menu choose Tools -> TkECLiPSe Preference Editor.
In preference window find option "Global/trail stack size (in megabytes)" and set it to 512.
Save preferences and close TkECLiPSe.
Next time you run TkECLiPSe stack size will be set to 512 Mb.

Console.log truncates my stacktrace. How to get longer prints?

I'm using console.log to debug errors while I develop, but it cuts off my stack traces after a handful of lines.
Is it possible to have it not do that?
Is there a better "print to stdout" that I should be using for longer chunks like stack traces?
Edit: Regarding a comment from Ryan Olds, the problem isn't that the stack only includes the most recent "event', but that the string being printed by console.log is truncating after a certain number of characters. It often stops in the middle of a line.
console.error(...) seems to print the full stack message.

amzi prolog + eclipse question

hey guys i have a question regarding amzi prolog with eclipse,
Im running a .pro file which executes a breadth first search and if queue gets too long,
the following error message appears:
system_error 1021 Control stack full.
Compile code or increase .cfg
parameter 'control'
If so, how may i run the compiled code under eclipse? I've tried running the project but the listener just ends without accepting any queries....?
Control stack full means one of two things:
You have a deep recursion that exhausts the control stack. In that case you need to increase the default value of 'control' in your amzi.cfg file. You may find you that have to increase 'heap', 'trail' and/or 'local' as well.
You have an error in your program causing an infinite recursion.
Running the program in the debugger will show you which case you've got. In the initial case you will see it digging deeper and deeper for a solution. In the later case you will see it chasing it's tail in circles with each recursion the same as the one before, but with different variables.
I don't know amzi prolog (I only used SICStus and SWI), and never used Eclipse for prolog, but as the error message says, try compiling (instead of consulting) your code. Look under project/properties for build configurations (like run/deug, as it works for Java/C++). Hopefully, that ".cfg paramerer" can also be accessed through project/properties.

Resources