Skip to contentSkip to conversation

App with pthreads using rt_task_shadow locks up

Xenomai-help Jochen Behnke 1 participant 1 message Mar 16, 2007

lore
Share & tools
lore
#0 lore raw

Philippe,

the workaround for the native skin is OK for me.
Thanks for your help :-)

Regards

Jochen

Quoted 37 lines · Jochen Behnke
Quoted 24 lines

Hello Philippe,

thanks for your response.

Quoted 11 lines · Jochen Behnke
Quoted 10 lines

Hello,

after hours of searching, I have finally found the problem.
It was a bug in my "SimpleRPC" library. The thread function, responsible for the "lockup", mainly constists of an endless loop ( while(pObj->nRun) ) that polls a request queue. This was not a problem as long as this thread was a standard pthread. Turning this thread into a real-time task by adding a call to rt_task_shadow at the beginning of the thread function (before the while loop) resulted in a frozen linux system.

I used to work with the following system
Gentoo Linux
Linux Kernel 2.6.17 (IPIPE 1.4)
Xenomai 2.2.3

Quoted 8 lines
Quoted 2 lines

Now that I know, that upgrading to Xenomai 2.3.0 is not a problem, I plan to upgrade to the 2.3.x branch.

You may detect such kind of issues switching on the CONFIG_XENO_OPT_WATCHDOG option in the kernel configuration. Normally, this would pull the brake after more than 4 seconds of uninterrupted real-time activity in primary mode (i.e. without yielding control to the regular Linux activities).

Quoted 4 lines

That's great. I will check this out.

BTW, is there an easy way, other than reboot, to release xenomai ressources (mutexes,...) that have not been freed after an application crash ?

This depends on the skin being used. The native one does not free the resources upon application exit yet (this feature is on the todo list for the upcoming 2.4 though), OTOH the POSIX skin does. A work-around with the native skin is to use constructs like the following one in your app to recycle the left overs; not pretty, but works, until we provide an automated support:

Quoted 10 lines
if (rt_mutex_bind("some_mutex", &mutex_desc, ...) == 0) {
	rt_mutex_delete(&mutex_desc);
}

err = rt_mutex_create("some_mutex", &mutex_desc);

Signature · 1 line
Philippe.

_______________________________________________________________________
Viren-Scan für Ihren PC! Jetzt für jeden. Sofort, online und kostenlos. Gleich testen! http://www.pc-sicherheit.web.de/freescan/?mc=022222