* [Xenomai-help] troubles deleting tasks @ 2006-11-10 13:17 Philipp Keller 2006-11-10 13:31 ` Philippe Gerum 2006-11-10 13:38 ` Jan Kiszka 0 siblings, 2 replies; 5+ messages in thread From: Philipp Keller @ 2006-11-10 13:17 UTC (permalink / raw) To: xenomai Hello We have troubles deleting the main task created with rt_task_shadow() from user space. In the course of initiating the program, we spawn two other threads from the main task with rt_task_spawn(). When ending the application, both the spawned tasks can be deleted with rt_task_delete(), but the main task returns with an unknown error code when calling rt_task_delete(). We believe to have released all recources before deleting, closing all sockets and file handlers. The trouble is that we cannot initiate rt can socket communication again after failing to delete the main thread. Doeas anyone have an idea what the probelm may be here? Thanks for any hint Philipp -- Philipp Keller Software Development Neuronics AG Technoparkstrasse 1 8005 Zuerich / Switzerland Tel +41 44 445 16 40 Fax +41 44 445 16 44 www.neuronics.ch -- ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] troubles deleting tasks 2006-11-10 13:17 [Xenomai-help] troubles deleting tasks Philipp Keller @ 2006-11-10 13:31 ` Philippe Gerum 2006-11-11 9:31 ` Philippe Gerum 2006-11-10 13:38 ` Jan Kiszka 1 sibling, 1 reply; 5+ messages in thread From: Philippe Gerum @ 2006-11-10 13:31 UTC (permalink / raw) To: Philipp Keller; +Cc: xenomai On Fri, 2006-11-10 at 14:17 +0100, Philipp Keller wrote: > Hello > > We have troubles deleting the main task created with rt_task_shadow() > from user space. > In the course of initiating the program, we spawn two other threads from > the main task with rt_task_spawn(). > When ending the application, both the spawned tasks can be deleted with > rt_task_delete(), but the main task returns with an unknown error code > when calling rt_task_delete(). Knowing which error code would help. > We believe to have released all recources before deleting, closing all > sockets and file handlers. > The trouble is that we cannot initiate rt can socket communication again > after failing to delete the main thread. > Doeas anyone have an idea what the probelm may be here? > > Thanks for any hint > Philipp > > > -- > Philipp Keller > Software Development > > Neuronics AG > Technoparkstrasse 1 > 8005 Zuerich / Switzerland > Tel +41 44 445 16 40 > Fax +41 44 445 16 44 > www.neuronics.ch -- Philippe. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] troubles deleting tasks 2006-11-10 13:31 ` Philippe Gerum @ 2006-11-11 9:31 ` Philippe Gerum 0 siblings, 0 replies; 5+ messages in thread From: Philippe Gerum @ 2006-11-11 9:31 UTC (permalink / raw) To: Philipp Keller; +Cc: xenomai On Fri, 2006-11-10 at 14:31 +0100, Philippe Gerum wrote: > On Fri, 2006-11-10 at 14:17 +0100, Philipp Keller wrote: > > Hello > > > > We have troubles deleting the main task created with rt_task_shadow() > > from user space. > > In the course of initiating the program, we spawn two other threads from > > the main task with rt_task_spawn(). > > When ending the application, both the spawned tasks can be deleted with > > rt_task_delete(), but the main task returns with an unknown error code > > when calling rt_task_delete(). > > Knowing which error code would help. > The following frag definitely works (i.e. the second printf() is not issued because the current task has been deleted in the meantime), even if using rt_task_self() for getting back the current task handle over the main context, so there must be something else going on with your application. Again, telling us the _exact_ error code value you get from rt_task_delete() is the only way to start investigating the issue; knowing that you apparently tested all the documented return codes in your program does _not_ tell us which value is actually returned, and therefore won't help much. #include <stdio.h> #include <sys/mman.h> #include <native/task.h> RT_TASK task; int main(int ac, char **av) { mlockall(MCL_CURRENT|MCL_FUTURE); printf("rt_task_create=%d\n", rt_task_shadow(&task, "task", 50, 0)); printf("rt_task_delete=%d\n", rt_task_delete(&task)); return 0; } > > We believe to have released all recources before deleting, closing all > > sockets and file handlers. > > The trouble is that we cannot initiate rt can socket communication again > > after failing to delete the main thread. > > Doeas anyone have an idea what the probelm may be here? > > > > Thanks for any hint > > Philipp > > > > > > -- > > Philipp Keller > > Software Development > > > > Neuronics AG > > Technoparkstrasse 1 > > 8005 Zuerich / Switzerland > > Tel +41 44 445 16 40 > > Fax +41 44 445 16 44 > > www.neuronics.ch -- Philippe. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] troubles deleting tasks 2006-11-10 13:17 [Xenomai-help] troubles deleting tasks Philipp Keller 2006-11-10 13:31 ` Philippe Gerum @ 2006-11-10 13:38 ` Jan Kiszka [not found] ` <4554875A.9060401@domain.hid> 1 sibling, 1 reply; 5+ messages in thread From: Jan Kiszka @ 2006-11-10 13:38 UTC (permalink / raw) To: Philipp Keller; +Cc: xenomai [-- Attachment #1: Type: text/plain, Size: 208 bytes --] Philipp Keller wrote: > Hello > > We have troubles deleting the main task created with rt_task_shadow() > from user space. https://mail.gna.org/public/xenomai-help/2006-11/msg00077.html ??? Jan [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <4554875A.9060401@domain.hid>]
* Re: [Xenomai-help] troubles deleting tasks [not found] ` <4554875A.9060401@domain.hid> @ 2006-11-10 14:44 ` Jan Kiszka 0 siblings, 0 replies; 5+ messages in thread From: Jan Kiszka @ 2006-11-10 14:44 UTC (permalink / raw) To: Philipp Keller; +Cc: Xenomai [-- Attachment #1: Type: text/plain, Size: 1252 bytes --] Philipp Keller wrote: > Thank you Jan. > > As to your answer: > That must be a different issue. Check /proc/xenomai/rtdm/open_fildes for > any leftover (CAN) file descriptor. Note that rt_dev_close() can fail if > the descriptor is busy. And such thing can happen if you simply kill the > task that currently blocks on a CAN device e.g. > > The correct ordering is therefore: close the sockets, catch the failure > in the blocking threads, and make them self-terminate. Granted, note the > most comfortable situation, but I'm sure we can improve it in the future > (e.g. via auto-cleanup also for RTDM file descriptors). > > I am actually doing that quite defensively I think, as you see in the > code snippet: [...] That code looks sane (for UP systems), and you are dumping all errors so that I can assume a non-closed socket would have been detected. So we now need more information on your precise issues, which are still two as I see it: rt_task_delete(&main) (actually a non-issue as I explained) and the failing re-opening of the CAN device. What error codes do you get? Can you derive a simple demo program that exposes the error and can be analysed by us? Jan PS: Yet another lacking reply-to-all... [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-11-11 9:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-10 13:17 [Xenomai-help] troubles deleting tasks Philipp Keller
2006-11-10 13:31 ` Philippe Gerum
2006-11-11 9:31 ` Philippe Gerum
2006-11-10 13:38 ` Jan Kiszka
[not found] ` <4554875A.9060401@domain.hid>
2006-11-10 14:44 ` Jan Kiszka
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.