2010-11-10 04:21:57     application hangs in pthread_create function

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

2010-11-10 04:21:57     application hangs in pthread_create function

Emil Bart (POLAND)

Message: 95739   

 

Hello,

 

During testing my application I encountered the problem that sometimes it hangs in pthread_create function. I don't know exactly how to reproduce the problem because it is a random behaviour. This is quite big application and it creates and terminates the threads. Once I was able to trigger the problem using gdbserver. The backtrace is as follows:

 

#2 pthread_create ()

 

#1 __pthread_wait_for_restart_signal ()

 

#0 __rt_sigsuspend

 

When it happens then every calling of pthread_create function in another thread also hangs up. Maybe someone had similar problem and can share with the solution.

 

Maybe this is a useful info but for every thread I change the stack size using function pthread_attr_set_stack_size ().

 

Thanks for any advice.

 

Emil.

QuoteReplyEditDelete

 

 

2010-11-10 04:34:44     Re: application hangs in pthread_create function

Mike Frysinger (UNITED STATES)

Message: 95740   

 

usually the first thing is to make sure you arent smashing the stack:

  docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:debugging_applications#multi-threaded_applications

QuoteReplyEditDelete

 

 

2010-11-10 04:39:12     Re: application hangs in pthread_create function

Emil Bart (POLAND)

Message: 95741   

 

Some more info:

 

- I always test the problem using the gdb. I will check if I the problem appears without gdbserver.

 

- compiler version : bfin-uclinux-g++ (GCC) 4.1.1 (ADI 06R2),

 

 

- uclinux distro: uClinux-dist_06r2-5. I know that it is very old version and many things was fixed but my employeer always tells me that we don;t have time for upgdare.

QuoteReplyEditDelete

 

 

2010-11-10 05:16:04     Re: application hangs in pthread_create function

Emil Bart (POLAND)

Message: 95745   

 

Hello Mike,

 

Writing smashing you mean stack overflowing ? If yes I'm almost sure that I don;t overflow the stack. The strange is that the application works some hours, terminates and creates threads without any problem and then suddently it hungs (doesn;t return any code) in the pthread_create function. When I test my application on the PC using valgrind or gdb I don;t have any problem and I do the same tests (automated tests).

QuoteReplyEditDelete

 

 

2010-11-10 09:26:57     Re: application hangs in pthread_create function

Emil Bart (POLAND)

Message: 95752   

 

The new problem appeared. I think that the root cause it the same. Now application hungs in malloc function. It is the same situation. The application works at least one hour and during that time allocates and deletes the memory and suddently calling of malloc hungs (no code is returned). The backtrace is :

 

#4 malloc ()

 

#3 __libc_system ()

 

#2 pthread_mutex_lock ()

 

#1 pthread_acquire ()

 

#0 sched_yield

 

I have never seen that kind of problems maybe somebody can help me.

QuoteReplyEditDelete

 

 

2010-11-10 09:28:09     Re: application hangs in pthread_create function

Emil Bart (POLAND)

Message: 95753   

 

Application is run under gdb.

QuoteReplyEditDelete

 

 

2010-11-10 16:16:04     Re: application hangs in pthread_create function

Mike Frysinger (UNITED STATES)

Message: 95759   

 

we've fixed many pthread/malloc bugs since 2006R1.  i vaguelly recall a pthread malloc locking bug being one of them.

Attachments

    Outcomes