2010-02-03 03:15:12     application stops

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2010-02-03 03:15:12     application stops

Filip Vanalme (BELGIUM)

Message: 85504   




After the Kernel has loaded on my BF561 board, I manually start my application. It runs well for a certain time, but then stops running suddenly without any indication of a problem (e.g. no Kernel panic). One could compare it with a user pressing Ctrl+C to stop the application.


Is there a way to track where the application has stopped ? The last instruction lines before stopping ?

(from the printf debugging information I added, I can see that the application probably quits when it does some socket action).




2010-02-03 03:24:53     Re: application stops

Mike Frysinger (UNITED STATES)

Message: 85524   


when you say "stop", you dont mean "hang" but rather "exit" ?


if the application isnt triggering a problem such that the kernel kills it, then generally it's because the application itself has requested the kernel to kill it (via exit()).  in that case, there is no tracking at all by anything.  if that is indeed the case, you might want to look at the atexit() function -- build your app with frame pointers, register a while(1); hang, and then if it exits, you can simply break in and (hopefully) get a backtrace.




2010-02-03 03:36:15     Re: application stops

Filip Vanalme (BELGIUM)

Message: 85525   


Hi Mike,


It's indeed an "exit". It returns to kernel prompt.


"the application itself has requested the kernel to kill it" : does that mean with a call to exit() ? Or are there other ways an application can request the Kernel to kill it ? As far as I can see, there's no exit() function as such in the code.


I'll have a look at atexit().




2010-02-03 03:43:41     Re: application stops

Mike Frysinger (UNITED STATES)

Message: 85526   


i mean the app has used memory incorrectly and caused a SIGSEGV or something (like using a NULL pointer).  and you get the nice verbose dump output.


off the top of my head, exit() is the only way an application can stop running without triggering the kernel dump output.




2010-02-03 04:01:17     Re: application stops

Filip Vanalme (BELGIUM)

Message: 85527   


I added the atexit() function in my main program. It calls ToDoBeforeExit(). Just to test it, I immediately do an exit after the call to atexit() and it indeed prints the string from ToDoBeforeExit(). The next step : removing the exit() and letting the program run until it quits. It does quit, but I don't see the final string from the ToDoBeforeExit() function...


As to the nice verbose output : I have to say that I had to return to my old 2006R2 release. 2009R1 not yet completely up and running and a deadline that is approaching very quickly...makes me continue on the old toolchain. So I don't think that old release will show that "nice verbose output". It will show certainly something, but I experienced already some time ago that the information is often hard to interprete. Anyway, it's worth trying.




2010-02-03 04:07:54     Re: application stops

Mike Frysinger (UNITED STATES)

Message: 85528   


the wiki has a page explaining how to interpret the output


you could run things through gdbserver and attach with gdb from your development system.  there shouldnt be any overhead here as gdb only gets notified when there's a problem.




2010-02-03 06:44:05     Re: application stops

Filip Vanalme (BELGIUM)

Message: 85534   


Narrowing down on the problem, I found that the application exits when calling the pthread_mutex_lock() function. Any idea why ?




2010-02-03 13:38:59     Re: application stops


Message: 85546   




Because you are using an old release with known bugs in it. 2006 has plenty of problems in it, just one of them being uClibc/pthread issues. The other is little to none anomaly workarounds (since the issues were not understood at the time).


Upgrade - the hastle will be worth the stablity (and performance boost) of your product.






2010-02-03 14:14:19     Re: application stops

Mike Frysinger (UNITED STATES)

Message: 85553   


pthread_mutex_lock() shouldnt cause an exit.  if it there a problem in the threading code, i would of expected a normal crash + dump message ...




2010-02-08 09:40:20     Re: application stops

Filip Vanalme (BELGIUM)

Message: 85765   


OK, I changed back to my 2009R1 version, trying to get application up and running. Compilation ends successfull. But, my application won't start up. It hangs while creating threads, finally showing : BUG: soft lockup - CPU#0 stuck for 61s! [xtg2:44]

It looks like it got stuck in a pthread_create call.


Never had this when application runs in 2006R2 environment. I assume posix thread handling (the way the application uses posix function calls) should act the same way in both versions. Lots of changes in using threads ?


I don't know if [xtg2:44] can tell me something (xtg2 is the name of the application, not of a file).