Skip to contentSkip to conversation

Resource leaking problem

Xenomai-help Dirk Eibach 3 participants 4 messages Sep 8, 2006 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

we have lots of tasks, semaphores and mutexes in our complex application. Stopping and restarting seems to leak some resources, because we get ENOMEM when a thread is created after restarting the application, first time everything goes well.

Probably we do something wrong, maybe somebody can tell us what.

What do we have to do in order to clean up all resources properly, especially if our application is ended by SIGKILL?

Cheers.

Signature · 5 lines
Dirk Eibach <[email protected]>
Guntermann & Drunck Systementwicklung GmbH
F & E
Dortmunder Str. 4a, D-57234 Wilnsdorf
Tel.: +49 (0) 2739 8901 100, Fax.: +49 (0) 2739 8901 120
#1 lore raw
Quoted 8 lines · Dirk Eibach

Hello,

we have lots of tasks, semaphores and mutexes in our complex application. Stopping and restarting seems to leak some resources, because we get ENOMEM when a thread is created after restarting the application, first time everything goes well.

Probably we do something wrong, maybe somebody can tell us what.

What skin do you use? Native? Only the POSIX skin currently does auto-cleanup, the others require explicit care.

Quoted 3 lines

What do we have to do in order to clean up all resources properly, especially if our application is ended by SIGKILL?

Install a signal handler and do cleanup of all allocated objects (tasks get deleted when they terminate). Either keep track of your allocated resources in some list(s) or signal the owners (tasks) that they should terminate and cleanup their locally allocated resources. There are dozens of ways to do this, depending on your application design.

But if you think that you are cleaning up correctly and still face leaks, try to derive a simple test that demonstrates the issue.

Jan

#2 lore raw
Quoted 5 lines · Jan Kiszka
Quoted 2 lines

What do we have to do in order to clean up all resources properly, especially if our application is ended by SIGKILL?

Install a signal handler and do cleanup of all allocated objects (tasks get deleted when they terminate).

Installing a signal handler for SIGKILL will not work, you should try and handle SIGTERM gracefully, and accept, in case of SIGKILL (which should remain rare anyway) to have to unload/reload Xenomai if it is compiled as a module, or reboot if it is built-in.

Signature · 1 line
					    Gilles Chanteperdrix.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Re: (WARNING!!! PGP with incorrect signature) Re: [Xenomai-help] Res

Quoted 26 lines · Dirk Eibach
Quoted 8 lines · [email protected] wrote:
Quoted 7 lines · Dirk Eibach

Hello,

we have lots of tasks, semaphores and mutexes in our complex application. Stopping and restarting seems to leak some resources, because we get ENOMEM when a thread is created after restarting the application, first time everything goes well.

Quoted 4 lines
Quoted 1 line

Probably we do something wrong, maybe somebody can tell us what.

What skin do you use? Native? Only the POSIX skin currently does auto-cleanup, the others require explicit care.

We are using native skin, so that explains the problem we are facing. Thanks.

Quoted 9 lines
Quoted 2 lines

What do we have to do in order to clean up all resources properly, especially if our application is ended by SIGKILL?

Install a signal handler and do cleanup of all allocated objects (tasks get deleted when they terminate). Either keep track of your allocated resources in some list(s) or signal the owners (tasks) that they should terminate and cleanup their locally allocated resources. There are dozens of ways to do this, depending on your application design.

Quoted 6 lines
Quoted 2 lines

But if you think that you are cleaning up correctly and still face leaks, try to derive a simple test that demonstrates the issue.

Hmmm, wouldn't it be clever to have a syscall that would allow us to free all xenomai resources at once, so we could call it on application startup? Otherwise SIGKILL will still be a problem.

Actually, the per-process cleanup is what we should head for also under the other skins. It will also address SIGKILL (which cannot be caught by a handler, of course). As most of us only have one brain to think and two hands to hack, and those are also shared resources ;), support is always welcome.

Jan