Skip to contentSkip to conversation

App with pthreads using rt_task_shadow locks up

Xenomai-help Jochen Behnke 2 participants 2 messages Mar 15, 2007

lore
Share & tools
lore
#0 lore raw

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).

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 ?

Thanks in advance.

Jochen

Quoted 50 lines
Quoted 50 lines

Regards

Jochen

Quoted 42 lines

Hello Gilles,

Quoted 8 lines
Quoted 7 lines · Jochen Behnke

Hello Gilles,

thanks for your response.
At the moment I try to cut down my application to the minimum.
I also will install the latest version of the xenomai 2.2.x branch (2.2.5) and check whether I can reproduce the fault. As I noticed that some functions have been changed (rt_mutex_lock/unlock no longer exist in Xenomai 2.3.x, they obviously have been renamed for some reason) I would rather stick to the 2.2.x branch. Is that reasonable in your opinion ? Will the 2.2.x branch be maintained in the future ?

Quoted 5 lines
Quoted 3 lines

Thanks again.

Jochen

Please do not forget to CC the list.

I'm sorry. I just used the wrong reply button.

Quoted 4 lines

rt_mutex_lock/rt_mutex_unlock were renamed rt_mutex_acquire/rt_mutex_release to avoid a conflict, as documented in API.CHANGES

I will have a look at this.

Quoted 5 lines

Please try with Xenomai 2.3.0, or better with trunk. The aim of this check is for us to avoid chasing bugs that were already solved. For example if you are using fork() in your application, only I-pipe patches in the trunk will solve your problem.

At the moment I don't use fork() but I can try using 2.3.x. I hope that I don't have to change too much code on my side.

As soon as I have results, I'll post them here.

Jochen

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Quoted 6 lines
Quoted 4 lines

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.

_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066

#1 lore raw
Quoted 24 lines · Jochen Behnke

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:

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.