Exe runs with no errors except when as Startup service

Hello,

I have written a whole cplusplus Ehe which I successfully and without errors are able to run as ./Program.
But when I add it as startup script, a) getline continuously receiving empty cr lf.
I disabled it by checking for empty chars, but why is this?
B) after exactly 2.37min the exe crashes with different errors like segmentation and malloc Etc. I commented out the mainloop, only objectthreads running then, no problems .
I enable one by one function calls and it seemed to be one function. But the next run, it crashes again after exact the same 2.37min.
I have timers, but none in this range. Also I changed check values (elapsedtime() > checkseconds) but everytime it is exactly 2.37min and error 134 or something in this range.
I tried manually run status service , except a broken enter key, I didn't get catch errors.
Every single piece of code runs within try-Catch.
However, still it crashes. :frowning:
Stop service and run like ./Program runs sunny for days and no single error or issue.
Start the same as service and ever 2.37min it crashes and reloads.
I tried fdb debug, but this only starts the terminal way and no error.

How can I debug a service to get a line where it crashes?
I have read upstart cookbook section 18... but I'm a newbie to Linux and beagle bones .. so can someone help me please with a working way (the code I can write myself.. just a way or explanation is enough, however fully example is appreciated;) ) to get the debug code and more important: reason or solution.

Thank you very much.

John