All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Salvini <mauro.salvini@domain.hid>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] rt_task_join() call hangs in shared lib destructor
Date: Thu, 28 Apr 2011 11:26:27 +0200 (CEST)	[thread overview]
Message-ID: <3161507.241303982782859.JavaMail.SYSTEM@pc-msalvini> (raw)
In-Reply-To: <27947354.221303982673109.JavaMail.SYSTEM@pc-msalvini>


[-- Attachment #1.1: Type: text/plain, Size: 1489 bytes --]



> It looks like a typical pthread_join deadlock. The thread you are 
> joining is locked on a pthread mutex, that some other thread (I would 
> say, the one calling pthread_join) has. It can not work. You should not 
> call pthread_join while holding a mutex. 

Yes, it looks like this, but I don't use any mutex in my task. It looks like dlclose() locks a mutex used also by pthread_join() (that was called into shared object destructor), and here is deadlock. But executing realtime task as normal thread does not raise this issue. 

Another strange behaviour: if task was not created with rt_task_create()-rt_task_start(), but becomes real time from a thread with rt_task_shadow(), it works properly. 

Summarizing: 
- create task with rt_task_create()-rt_task_start() and join it in shared object destructor with rt_task_join() -> deadlock 
- create a thread with pthread_create(), make it real-time with rt_task_shadow() and join it in destructor with rt_task_join() -> works fine 
- create a thread with pthread_create(), join it in destructor with pthread_join() -> works fine 

Same behaviors on kernel 2.6.37 with Xenomai 2.5.6 Ipipe 2.9-00 . 

> If this is not the issue, would you please take the time to post a 
> self-contained test case which I can run to reproduce the issue? 

Was attached on my first mail, I re-attach it to this mail. I also added 2nd and 3rd case explained above: you can select each case with three #defines into TestMod.c. 

Many thanks, regards. 


[-- Attachment #1.2: Type: text/html, Size: 1971 bytes --]

[-- Attachment #2: sample.zip --]
[-- Type: application/x-zip-compressed, Size: 1751 bytes --]

       reply	other threads:[~2011-04-28  9:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <27947354.221303982673109.JavaMail.SYSTEM@pc-msalvini>
2011-04-28  9:26 ` Mauro Salvini [this message]
2011-04-28 11:06   ` [Xenomai-help] rt_task_join() call hangs in shared lib destructor Gilles Chanteperdrix
2011-04-28 11:45     ` Gilles Chanteperdrix
     [not found] <33469777.411303994184796.JavaMail.SYSTEM@pc-msalvini>
2011-04-28 12:41 ` Mauro Salvini
2011-04-28 13:33   ` Gilles Chanteperdrix
     [not found] <30435812.01303909424265.JavaMail.SYSTEM@pc-msalvini>
2011-04-27 13:06 ` Mauro Salvini
     [not found] <11882793.141303825258312.JavaMail.SYSTEM@pc-msalvini>
2011-04-26 13:50 ` Mauro Salvini
2011-04-26 18:06   ` Gilles Chanteperdrix
2011-04-27 16:59   ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3161507.241303982782859.JavaMail.SYSTEM@pc-msalvini \
    --to=mauro.salvini@domain.hid \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.