Skip to contentSkip to conversation

mutex problem

Xenomai Petr Cervenka 2 participants 7 messages Feb 28, 2013 – Mar 11, 2013

lore
Share & tools
lore
#0 lore raw

Hello.

I have a problem with a mutex shared by 3 real-time user tasks. Once in a while (~hours) the mutex get locked with the first task as owner and the other two tasks are fronzen on rt_mutex_aquire calls. But I have double checked, that every "acquire" of that mutex is followed by "release".

Typical example:
Lets call those tasks REG, SEND, RECEIVE

RECV: acquire
RECV: release

RECV: acquire
RECV: release

RECV: acquire - FREEZE

REG: acquire
REG: release

REG: acquire
REG: release

REG: acquire
REG: release

SEND: acquire - FREEZE

There are also other threads, sync. objects, network sockets, ... in the system, but the threads are frozen by this particular mutex. rt_task_unblock call unblocks the tasks, return value of rt_mutex_acquire is -4 (-EINTR), as expected.
Used version of Xenomai 2.5.6, skin native. Was there any known issue similar to that behavior?
Also it seems that rt_mutex_create is called before mlockall call? Could it be a problem?

Petr Cervenka

#1 lore raw
Quoted 24 lines · Petr Cervenka

Hello.

I have a problem with a mutex shared by 3 real-time user tasks. Once in a while (~hours) the mutex get locked with the first task as owner and the other two tasks are fronzen on rt_mutex_aquire calls. But I have double checked, that every "acquire" of that mutex is followed by "release".

Typical example:
Lets call those tasks REG, SEND, RECEIVE

RECV: acquire
RECV: release

RECV: acquire
RECV: release

RECV: acquire - FREEZE

REG: acquire
REG: release

REG: acquire
REG: release

REG: acquire
REG: release

Quoted 6 lines

SEND: acquire - FREEZE

There are also other threads, sync. objects, network sockets, ... in the system, but the threads are frozen by this particular mutex. rt_task_unblock call unblocks the tasks, return value of rt_mutex_acquire is -4 (-EINTR), as expected.
Used version of Xenomai 2.5.6, skin native. Was there any known issue similar to that behavior?
Also it seems that rt_mutex_create is called before mlockall call? Could it be a problem?

It is a bit old to recall. Could you try and reproduce the problem with 2.6.2.1 ?

Signature · 1 line
                                                                Gilles.
#2 lore raw

SOLVED (perhaps)

Quoted 27 lines
Quoted 27 lines

Hello.

I have a problem with a mutex shared by 3 real-time user tasks. Once in a while (~hours) the mutex get locked with the first task as owner and the other two tasks are fronzen on rt_mutex_aquire calls. But I have double checked, that every "acquire" of that mutex is followed by "release".

Typical example:
Lets call those tasks REG, SEND, RECEIVE

RECV: acquire
RECV: release

RECV: acquire
RECV: release

RECV: acquire - FREEZE

REG: acquire
REG: release

REG: acquire
REG: release

REG: acquire
REG: release

SEND: acquire - FREEZE

Quoted 9 lines
Quoted 4 lines

There are also other threads, sync. objects, network sockets, ... in the system, but the threads are frozen by this particular mutex. rt_task_unblock call unblocks the tasks, return value of rt_mutex_acquire is -4 (-EINTR), as expected.
Used version of Xenomai 2.5.6, skin native. Was there any known issue similar to that behavior?
Also it seems that rt_mutex_create is called before mlockall call? Could it be a problem?

It is a bit old to recall. Could you try and reproduce the problem with 2.6.2.1 ?

I tried to use new version of everything (kernel 3.5.7, xenomai 2.6.2.1, ...) and I got some exception to the kernel log in rt_mutex_create.
So I suppose that the problem was caused by calling of rt_mutex_create before mlockall. I already fixed it and now I'm waiting for some longer term results. I for now it seems to be SOLVED. If not, I will let you know. Thank you for your support.

Petr Cervenka

#3 lore raw
Quoted 40 lines · Petr Cervenka

SOLVED (perhaps)

Quoted 34 lines
Quoted 25 lines

Hello.

I have a problem with a mutex shared by 3 real-time user tasks. Once in a while (~hours) the mutex get locked with the first task as owner and the other two tasks are fronzen on rt_mutex_aquire calls. But I have double checked, that every "acquire" of that mutex is followed by "release".

Typical example: Lets call those tasks REG, SEND, RECEIVE

RECV: acquire RECV: release

RECV: acquire RECV: release

RECV: acquire - FREEZE

REG: acquire REG: release

REG: acquire REG: release

REG: acquire REG: release

SEND: acquire - FREEZE

Quoted 7 lines

There are also other threads, sync. objects, network sockets, ... in the system, but the threads are frozen by this particular mutex. rt_task_unblock call unblocks the tasks, return value of rt_mutex_acquire is -4 (-EINTR), as expected. Used version of Xenomai 2.5.6, skin native. Was there any known issue similar to that behavior? Also it seems that rt_mutex_create is called before mlockall call? Could it be a problem?

Quoted 3 lines

It is a bit old to recall. Could you try and reproduce the problem with 2.6.2.1 ?

Quoted 6 lines

I tried to use new version of everything (kernel 3.5.7, xenomai 2.6.2.1, ...) and I got some exception to the kernel log in rt_mutex_create. So I suppose that the problem was caused by calling of rt_mutex_create before mlockall. I already fixed it and now I'm waiting for some longer term results. I for now it seems to be SOLVED. If not, I will let you know. Thank you for your support.

It is not expected to get a crash, though, will try and see if I can reproduce the problem.

Signature · 1 line
                                                                Gilles.
#4 lore raw

Now I can confirm, that the problem didn't disappeared. It just moved elsewhere.
Another mutex stays locked and another thread is endlessly waiting for its release. But this time, its less critical combination of mutex / thread (and less frequently used). Is there anything I can check or try?

Petr

PS: When I'm thinking about it, the mutex is again one of the first mutexes (if not completely first) created in the application. Even before rt_task_shadow(...).

Quoted 52 lines
Quoted 41 lines

SOLVED (perhaps)

Quoted 34 lines
Quoted 25 lines

Hello.

I have a problem with a mutex shared by 3 real-time user tasks. Once in a while (~hours) the mutex get locked with the first task as owner and the other two tasks are fronzen on rt_mutex_aquire calls. But I have double checked, that every "acquire" of that mutex is followed by "release".

Typical example: Lets call those tasks REG, SEND, RECEIVE

RECV: acquire RECV: release

RECV: acquire RECV: release

RECV: acquire - FREEZE

REG: acquire REG: release

REG: acquire REG: release

REG: acquire REG: release

SEND: acquire - FREEZE

Quoted 7 lines

There are also other threads, sync. objects, network sockets, ... in the system, but the threads are frozen by this particular mutex. rt_task_unblock call unblocks the tasks, return value of rt_mutex_acquire is -4 (-EINTR), as expected. Used version of Xenomai 2.5.6, skin native. Was there any known issue similar to that behavior? Also it seems that rt_mutex_create is called before mlockall call? Could it be a problem?

Quoted 3 lines

It is a bit old to recall. Could you try and reproduce the problem with 2.6.2.1 ?

Quoted 6 lines

I tried to use new version of everything (kernel 3.5.7, xenomai 2.6.2.1, ...) and I got some exception to the kernel log in rt_mutex_create. So I suppose that the problem was caused by calling of rt_mutex_create before mlockall. I already fixed it and now I'm waiting for some longer term results. I for now it seems to be SOLVED. If not, I will let you know. Thank you for your support.

It is not expected to get a crash, though, will try and see if I can reproduce the problem.

#5 lore raw
In reply to Gilles Chanteperdrix

The problem with mutexes is still present. I'm really desperate now. Does anyone know, how the mutex could "stay locked" when every "acquire" is sooner or later followed by "release" and both functions always return 0 (success) code? Every advice is appreciated.

Petr

Quoted 52 lines
Quoted 38 lines
Quoted 34 lines
Quoted 25 lines

Hello.

I have a problem with a mutex shared by 3 real-time user tasks. Once in a while (~hours) the mutex get locked with the first task as owner and the other two tasks are fronzen on rt_mutex_aquire calls. But I have double checked, that every "acquire" of that mutex is followed by "release".

Typical example: Lets call those tasks REG, SEND, RECEIVE

RECV: acquire RECV: release

RECV: acquire RECV: release

RECV: acquire - FREEZE

REG: acquire REG: release

REG: acquire REG: release

REG: acquire REG: release

SEND: acquire - FREEZE

Quoted 7 lines

There are also other threads, sync. objects, network sockets, ... in the system, but the threads are frozen by this particular mutex. rt_task_unblock call unblocks the tasks, return value of rt_mutex_acquire is -4 (-EINTR), as expected. Used version of Xenomai 2.5.6, skin native. Was there any known issue similar to that behavior? Also it seems that rt_mutex_create is called before mlockall call? Could it be a problem?

Quoted 3 lines

It is a bit old to recall. Could you try and reproduce the problem with 2.6.2.1 ?

Quoted 6 lines

I tried to use new version of everything (kernel 3.5.7, xenomai 2.6.2.1, ...) and I got some exception to the kernel log in rt_mutex_create. So I suppose that the problem was caused by calling of rt_mutex_create before mlockall. I already fixed it and now I'm waiting for some longer term results. I for now it seems to be SOLVED. If not, I will let you know. Thank you for your support.

It is not expected to get a crash, though, will try and see if I can reproduce the problem.

Signature · 1 line
                                                               Gilles.
#6 lore raw
Quoted 4 lines · Petr Cervenka

The problem with mutexes is still present. I'm really desperate now. Does anyone know, how the mutex could "stay locked" when every "acquire" is sooner or later followed by "release" and both functions always return 0 (success) code? Every advice is appreciated.

Could you provide us with a simple test case which would allow us to reproduce the problem?

Other than that, you can try forcing the path through the kernel for every mutex call, enable the I-pipe tracer, and trigger a trace as soon as you detect that the mutex is not free after a release.

Signature · 1 line
                                                                Gilles.