* [Xenomai] [xenomai-forge] Task blocked in t_delete @ 2015-04-30 8:14 Ronny Meeus 2015-04-30 10:01 ` Philippe Gerum 0 siblings, 1 reply; 9+ messages in thread From: Ronny Meeus @ 2015-04-30 8:14 UTC (permalink / raw) To: xenomai; +Cc: martin.bielik.sk Hello we are using the xenomai-forge mercury core together with the pSOS interface. We observe following issue: we have 3 tasks at different priorities (see test code attached). The task with the middle priority is running forever (while (1)). The higest prio task is responsible cleaning up the 2 other tasks. If the middle prio task is deleted first, followed by the low prio, it works. If the low prio task is deleted first, the high prio task just blocks on the delete and the system hangs in that phase. My assumption is that this is a bug in the delete functionality. Is this a known issue? Ronny -------------- next part -------------- A non-text attachment was scrubbed... Name: task_hang.c Type: text/x-csrc Size: 1645 bytes Desc: not available URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20150430/aa0c3e0f/attachment.c> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-04-30 8:14 [Xenomai] [xenomai-forge] Task blocked in t_delete Ronny Meeus @ 2015-04-30 10:01 ` Philippe Gerum 2015-04-30 12:39 ` Ronny Meeus 0 siblings, 1 reply; 9+ messages in thread From: Philippe Gerum @ 2015-04-30 10:01 UTC (permalink / raw) To: Ronny Meeus, xenomai; +Cc: martin.bielik.sk On 04/30/2015 10:14 AM, Ronny Meeus wrote: > Hello > > we are using the xenomai-forge mercury core together with the pSOS interface. > > We observe following issue: we have 3 tasks at different priorities > (see test code attached). > The task with the middle priority is running forever (while (1)). > > The higest prio task is responsible cleaning up the 2 other tasks. > If the middle prio task is deleted first, followed by the low prio, it works. > If the low prio task is deleted first, the high prio task just blocks > on the delete and the system hangs in that phase. > I could not reproduce this bug with your test case unmodified after an hour running this program in loop. Could you paste the output of --dump-config so that I can align on your settings? > My assumption is that this is a bug in the delete functionality. > Is this a known issue? > No report from such issue. -- Philippe. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-04-30 10:01 ` Philippe Gerum @ 2015-04-30 12:39 ` Ronny Meeus 2015-04-30 13:09 ` Philippe Gerum 0 siblings, 1 reply; 9+ messages in thread From: Ronny Meeus @ 2015-04-30 12:39 UTC (permalink / raw) To: Philippe Gerum; +Cc: martin.bielik.sk, xenomai On Thu, Apr 30, 2015 at 12:01 PM, Philippe Gerum <rpm@xenomai.org> wrote: > On 04/30/2015 10:14 AM, Ronny Meeus wrote: >> Hello >> >> we are using the xenomai-forge mercury core together with the pSOS interface. >> >> We observe following issue: we have 3 tasks at different priorities >> (see test code attached). >> The task with the middle priority is running forever (while (1)). >> >> The higest prio task is responsible cleaning up the 2 other tasks. >> If the middle prio task is deleted first, followed by the low prio, it works. >> If the low prio task is deleted first, the high prio task just blocks >> on the delete and the system hangs in that phase. >> > > I could not reproduce this bug with your test case unmodified after an > hour running this program in loop. Could you paste the output of > --dump-config so that I can align on your settings? > CONFIG_MMU=1 CONFIG_SMP=1 CONFIG_XENO_ASYNC_CANCEL=1 CONFIG_XENO_BUILD_ARGS=" '--target=armeb-buildroot-linux-gnueabi' '--host=armeb-buildroot-linux-gnueabi' '--build=x86_64-unknown-linux-gnu' '--prefix=/usr' '--exec-prefix=/usr' '--sysconfdir=/etc' '--program-prefix=' '--disable-gtk-doc' '--disable-doc' '--disable-docs' '--disable-documentation' '--with-xmlto=no' '--with-fop=no' '--enable-ipv6' '--enable-static' '--enable-shared' '--with-core=mercury' '--includedir=/usr/include/xenomai-forge' '--disable-doc-install' '--enable-lores-clock' '--enable-smp' '--enable-async-cancel' '--enable-registry' 'build_alias=x86_64-unknown-linux-gnu' 'host_alias=armeb-buildroot-linux-gnueabi' 'target_alias=armeb-buildroot-linux-gnueabi' 'CC=/repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/host/usr/bin/armeb-linux-gcc' 'CFLAGS=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -mcpu=arm1176jz-s -Os ' 'LDFLAGS=' 'CPPFLAGS=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' 'CPP=/repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/host/usr/bin/armeb-linux-cpp' 'PKG_CONFIG=/repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/host/usr/bin/pkg-config'" CONFIG_XENO_BUILD_STRING="x86_64-unknown-linux-gnu" CONFIG_XENO_COMPILER="gcc version 4.4.3 (crosstool-NG 1.19.0) " CONFIG_XENO_DEFAULT_PERIOD=1000000 CONFIG_XENO_FORTIFY=1 CONFIG_XENO_HOST_STRING="armeb-buildroot-linux-gnueabi" CONFIG_XENO_MERCURY=1 CONFIG_XENO_PREFIX="/usr" CONFIG_XENO_REGISTRY=1 CONFIG_XENO_REVISION_LEVEL=7 CONFIG_XENO_SANITY=1 CONFIG_XENO_TLSF=1 CONFIG_XENO_TLS_MODEL="initial-exec" CONFIG_XENO_UAPI_LEVEL=8 CONFIG_XENO_VERSION_MAJOR=2 CONFIG_XENO_VERSION_MINOR=99 CONFIG_XENO_X86_VSYSCALL=1 --- CONFIG_XENO_ARM_SA1100 is OFF CONFIG_XENO_ARM_TSC_TYPE is OFF CONFIG_XENO_COBALT is OFF CONFIG_XENO_COPPERPLATE_CLOCK_RESTRICTED is OFF CONFIG_XENO_CPU_XSC3 is OFF CONFIG_XENO_DEBUG is OFF CONFIG_XENO_DEBUG_FULL is OFF CONFIG_XENO_LIBS_DLOPEN is OFF CONFIG_XENO_LORES_CLOCK_DISABLED is OFF CONFIG_XENO_PSHARED is OFF CONFIG_XENO_RAW_CLOCK_ENABLED is OFF CONFIG_XENO_VALGRIND_API is OFF >> My assumption is that this is a bug in the delete functionality. >> Is this a known issue? >> > > No report from such issue. > If I run the test I see: /tmp # ./task_delete Start of test Create and start main task:Create task M: Create task L: Start task M: Start task L: M: entry L: entry M: Dead loop starts Cleaning .. End of test Here is the piece of the code that goes wrong: printf("Cleaning ..\r\n"); /* Remove tasks */ t_delete(L_id); /* Followed code is not executed because t_delete is somehow blocked */ printf("Removed L task id = 0x%lx\r\n", L_id); t_delete(M_id); printf("Removed M task id = 0x%lx\r\n", M_id); } Since the trace "Removed L task id..." is not generated, my assumption it that the t_delete(L_id) blocks. Ronny ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-04-30 12:39 ` Ronny Meeus @ 2015-04-30 13:09 ` Philippe Gerum 2015-04-30 13:55 ` Ronny Meeus 0 siblings, 1 reply; 9+ messages in thread From: Philippe Gerum @ 2015-04-30 13:09 UTC (permalink / raw) To: Ronny Meeus; +Cc: martin.bielik.sk, xenomai On 04/30/2015 02:39 PM, Ronny Meeus wrote: > If I run the test I see: > > /tmp # ./task_delete > Start of test > Create and start main task:Create task M: > Create task L: > Start task M: > Start task L: > M: entry > L: entry > M: Dead loop starts > Cleaning .. > End of test > > Here is the piece of the code that goes wrong: > > printf("Cleaning ..\r\n"); > /* Remove tasks */ > t_delete(L_id); > /* Followed code is not executed because t_delete is somehow blocked */ > printf("Removed L task id = 0x%lx\r\n", L_id); > t_delete(M_id); > printf("Removed M task id = 0x%lx\r\n", M_id); > } > > Since the trace "Removed L task id..." is not generated, my assumption > it that the t_delete(L_id) blocks. > > Could you attach GDB to the hung process, then dump a backtrace for all the remaining threads? -- Philippe. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-04-30 13:09 ` Philippe Gerum @ 2015-04-30 13:55 ` Ronny Meeus 2015-05-01 16:55 ` Philippe Gerum 0 siblings, 1 reply; 9+ messages in thread From: Ronny Meeus @ 2015-04-30 13:55 UTC (permalink / raw) To: Philippe Gerum; +Cc: martin.bielik.sk, xenomai On Thu, Apr 30, 2015 at 3:09 PM, Philippe Gerum <rpm@xenomai.org> wrote: > On 04/30/2015 02:39 PM, Ronny Meeus wrote: >> If I run the test I see: >> >> /tmp # ./task_delete >> Start of test >> Create and start main task:Create task M: >> Create task L: >> Start task M: >> Start task L: >> M: entry >> L: entry >> M: Dead loop starts >> Cleaning .. >> End of test >> >> Here is the piece of the code that goes wrong: >> >> printf("Cleaning ..\r\n"); >> /* Remove tasks */ >> t_delete(L_id); >> /* Followed code is not executed because t_delete is somehow blocked */ >> printf("Removed L task id = 0x%lx\r\n", L_id); >> t_delete(M_id); >> printf("Removed M task id = 0x%lx\r\n", M_id); >> } >> >> Since the trace "Removed L task id..." is not generated, my assumption >> it that the t_delete(L_id) blocks. >> >> > > Could you attach GDB to the hung process, then dump a backtrace for all > the remaining threads? > > -- > Philippe. Philippe I have put a breakpoint in main @ line 62: 57 printf("Create and start main task:"); 58 t_create("MaIn",10, 16000, 16000,0,&tid); 59 ret = t_start(tid, 0, main_task, NULL); 60 if (0 != ret) {printf("Failed %lu\r\n",ret);return -1;} 61 sleep(10); 62 t_delete(tid); 63 printf("End of test\n\r"); 64 return 0; and I generated a backtrace for all threads, see below. It looks like the "MaIn" task is wating on a semaphore. (gdb) set pagination off (gdb) info threads Id Target Id Frame 6 Thread 16395 0xb6eb6c34 in nanosleep () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 5 Thread 16394 m_task () at task_delete.c:12 4 Thread 16374 0xb6f9fcf4 in do_sigwait () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 * 3 Thread 16372 0xb6f9e900 in read () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 2 Thread 16393 0xb6f9d700 in sem_wait@@GLIBC_2.4 () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 1 Thread 16325 main (argc=1, argv=0x11110, envp=0xbefffc08) at task_delete.c:62 0 16325 16322 20 N 0 t (main) 0 16372 16322 20 N 0 t (task_delete) 0 16374 16322 -95 F 0 t (timer-internal) 0 16393 16322 -11 F 0 t (MaIn) 0 16394 16322 -6 F 0 t (M) 0 16395 16322 -5 F 0 t (L) (gdb) thread apply all bt full Thread 6 (Thread 16395): #0 0xb6eb6c34 in nanosleep () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. #1 0xb6eb69cc in sleep () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. #2 0x00008718 in l_task () at task_delete.c:18 No locals. #3 0xb6fd2400 in task_trampoline (arg=<optimized out>) at task.c:225 task = 0x23218 param_ex = {__sched_priority = -1224959724, sched_u = {rr = {__sched_rr_quantum = {tv_sec = 0, tv_nsec = -1227485752}}}} svc = {cancel_type = 1} __FUNCTION__ = "task_trampoline" #4 0xb6fb6a78 in thread_trampoline (arg=<optimized out>) at internal.c:234 cta = <optimized out> _cta = {stacksize = 131072, detachstate = 1, policy = 1, param_ex = {__sched_priority = 4, sched_u = {rr = {__sched_rr_quantum = {tv_sec = -1227287440, tv_nsec = 16}}}}, prologue = 0xb6fd2424 <task_prologue>, run = 0xb6fd22f4 <task_trampoline>, arg = 0x23218, __reserved = {status = -38, warm = {__size = "\000\000\000\000\000\000\000\200\000\000\000\000\266\364\265\300", __align = 0}, released = 0xb6f4c220}} released = {__size = "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000", __align = 0} ret = 0 __FUNCTION__ = "thread_trampoline" #5 0xb6f956fc in start_thread () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #6 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. #7 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 5 (Thread 16394): #0 m_task () at task_delete.c:12 No locals. #1 0xb6fd2400 in task_trampoline (arg=<optimized out>) at task.c:225 task = 0x22ea0 param_ex = {__sched_priority = -1224959724, sched_u = {rr = {__sched_rr_quantum = {tv_sec = 0, tv_nsec = -1227354680}}}} svc = {cancel_type = 1} __FUNCTION__ = "task_trampoline" #2 0xb6fb6a78 in thread_trampoline (arg=<optimized out>) at internal.c:234 cta = <optimized out> _cta = {stacksize = 131072, detachstate = 1, policy = 1, param_ex = {__sched_priority = 5, sched_u = {rr = {__sched_rr_quantum = {tv_sec = -1227287440, tv_nsec = 44}}}}, prologue = 0xb6fd2424 <task_prologue>, run = 0xb6fd22f4 <task_trampoline>, arg = 0x22ea0, __reserved = {status = -38, warm = {__size = "\000\000\000\000\000\000\000\200\000\000\000\000\266\364\265\300", __align = 0}, released = 0xb6f4c220}} released = {__size = "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000", __align = 0} ret = 0 __FUNCTION__ = "thread_trampoline" #3 0xb6f956fc in start_thread () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #4 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. #5 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 4 (Thread 16374): #0 0xb6f9fcf4 in do_sigwait () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #1 0xb6f9fd90 in sigwait () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #2 0xb6fb9c00 in timerobj_server (arg=<optimized out>) at timerobj.c:141 now = {tv_sec = 199495, tv_nsec = 940506114} value = {tv_sec = 0, tv_nsec = -1225166640} interval = {tv_sec = -1227027076, tv_nsec = 0} tmobj = 0xb6fc9ce8 tmp = 0xb6fc9ce8 set = {__val = {8192, 0 <repeats 31 times>}} sig = 14 sev = {sigev_value = {sival_int = 0, sival_ptr = 0x0}, sigev_signo = 14, sigev_notify = 4, _sigev_un = {_pad = {16374, 0 <repeats 12 times>}, _tid = 16374, _sigev_thread = {_function = 0x3ff6, _attribute = 0x0}}} periodic_timer = 0x30b47 it = {it_interval = {tv_sec = 0, tv_nsec = 10000000}, it_value = {tv_sec = 0, tv_nsec = 10000000}} ticks = 983 __FUNCTION__ = "timerobj_server" #3 0xb6fb6a78 in thread_trampoline (arg=<optimized out>) at internal.c:234 cta = <optimized out> _cta = {stacksize = 262144, detachstate = 1, policy = 1, param_ex = {__sched_priority = 94, sched_u = {rr = {__sched_rr_quantum = {tv_sec = 1, tv_nsec = 5}}}}, prologue = 0xb6fb9714 <server_prologue>, run = 0xb6fb9b3c <timerobj_server>, arg = 0x0, __reserved = {status = -38, warm = {__size = "\000\000\000\000\000\000\000\200\000\000\000\001\266\374\231\024", __align = 0}, released = 0xbefffb94}} released = {__size = "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000", __align = 0} ret = 0 __FUNCTION__ = "thread_trampoline" #4 0xb6f956fc in start_thread () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #5 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. #6 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 3 (Thread 16372): #0 0xb6f9e900 in read () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #1 0xb6f9e1bc in __pthread_enable_asynccancel () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #2 0x00021000 in ?? () No symbol table info available. #3 0x00021000 in ?? () No symbol table info available. Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 2 (Thread 16393): #0 0xb6f9d700 in sem_wait@@GLIBC_2.4 () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #1 0xb6fb87f8 in cancel_sync (thobj=<optimized out>) at threadobj.c:1274 oldstate = 0 ret = -1227484048 sem = 0x235c0 #2 0xb6fb88d8 in threadobj_cancel (thobj=0x232a0) at threadobj.c:1310 No locals. #3 0xb6fd2214 in t_delete (tid=143896) at task.c:713 task = <optimized out> svc = {cancel_type = 1} ret = <optimized out> #4 0x00008894 in main_task () at task_delete.c:45 M_id = 143008 L_id = 143896 ret = 0 #5 0xb6fd2400 in task_trampoline (arg=<optimized out>) at task.c:225 task = 0x22b10 param_ex = {__sched_priority = -1224959724, sched_u = {rr = {__sched_rr_quantum = {tv_sec = 0, tv_nsec = -1227289144}}}} svc = {cancel_type = 1} __FUNCTION__ = "task_trampoline" #6 0xb6fb6a78 in thread_trampoline (arg=<optimized out>) at internal.c:234 cta = <optimized out> _cta = {stacksize = 32000, detachstate = 1, policy = 1, param_ex = {__sched_priority = 10, sched_u = {rr = {__sched_rr_quantum = {tv_sec = -1224757248, tv_nsec = -1224842860}}}}, prologue = 0xb6fd2424 <task_prologue>, run = 0xb6fd22f4 <task_trampoline>, arg = 0x22b10, __reserved = {status = -38, warm = {__size = "\000\000\000\000\000\000\000\200\000\000\000\001\000\000\000", __align = 0}, released = 0x0}} released = {__size = "\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000", __align = 0} ret = 0 __FUNCTION__ = "thread_trampoline" #7 0xb6f956fc in start_thread () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libpthread.so.0 No symbol table info available. #8 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. #9 0xb6ee8c08 in clone () from /repo/meeusr/sw-memmngt/vobs/esam/build/reborn/buildroot-isam-reborn-arm-nrnti/output/staging/lib/libc.so.6 No symbol table info available. Backtrace stopped: previous frame identical to this frame (corrupt stack?) Thread 1 (Thread 16325): #0 main (argc=1, argv=0x11110, envp=0xbefffc08) at task_delete.c:62 tid = 142096 ret = 0 (gdb) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-04-30 13:55 ` Ronny Meeus @ 2015-05-01 16:55 ` Philippe Gerum 2015-05-02 18:48 ` Ronny Meeus 0 siblings, 1 reply; 9+ messages in thread From: Philippe Gerum @ 2015-05-01 16:55 UTC (permalink / raw) To: Ronny Meeus; +Cc: martin.bielik.sk, xenomai On 04/30/2015 03:55 PM, Ronny Meeus wrote: > On Thu, Apr 30, 2015 at 3:09 PM, Philippe Gerum <rpm@xenomai.org> wrote: >> On 04/30/2015 02:39 PM, Ronny Meeus wrote: >>> If I run the test I see: >>> >>> /tmp # ./task_delete >>> Start of test >>> Create and start main task:Create task M: >>> Create task L: >>> Start task M: >>> Start task L: >>> M: entry >>> L: entry >>> M: Dead loop starts >>> Cleaning .. >>> End of test >>> >>> Here is the piece of the code that goes wrong: >>> >>> printf("Cleaning ..\r\n"); >>> /* Remove tasks */ >>> t_delete(L_id); >>> /* Followed code is not executed because t_delete is somehow blocked */ >>> printf("Removed L task id = 0x%lx\r\n", L_id); >>> t_delete(M_id); >>> printf("Removed M task id = 0x%lx\r\n", M_id); >>> } >>> >>> Since the trace "Removed L task id..." is not generated, my assumption >>> it that the t_delete(L_id) blocks. >>> >>> >> >> Could you attach GDB to the hung process, then dump a backtrace for all >> the remaining threads? >> >> -- >> Philippe. > > Philippe > > I have put a breakpoint in main @ line 62: > > 57 printf("Create and start main task:"); > 58 t_create("MaIn",10, 16000, 16000,0,&tid); > 59 ret = t_start(tid, 0, main_task, NULL); > 60 if (0 != ret) {printf("Failed %lu\r\n",ret);return -1;} > 61 sleep(10); > 62 t_delete(tid); > 63 printf("End of test\n\r"); > 64 return 0; > > and I generated a backtrace for all threads, see below. > It looks like the "MaIn" task is wating on a semaphore. [snip] This is a priority inversion issue caused by the handshake mechanism between the caller of t_delete() and the killed task finalizer. I eventually reproduced it after I figured out that pinning all tasks on the same CPU was required to trigger such bug. This patch should help: http://git.xenomai.org/xenomai-3.git/commit/?h=next&id=8431d7149405235fb0aebb53ed32a537ad968c7e -- Philippe. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-05-01 16:55 ` Philippe Gerum @ 2015-05-02 18:48 ` Ronny Meeus 2015-05-05 6:04 ` Ronny Meeus 0 siblings, 1 reply; 9+ messages in thread From: Ronny Meeus @ 2015-05-02 18:48 UTC (permalink / raw) To: Philippe Gerum; +Cc: martin.bielik.sk, xenomai > This is a priority inversion issue caused by the handshake mechanism > between the caller of t_delete() and the killed task finalizer. I > eventually reproduced it after I figured out that pinning all tasks on > the same CPU was required to trigger such bug. This patch should help: > > http://git.xenomai.org/xenomai-3.git/commit/?h=next&id=8431d7149405235fb0aebb53ed32a537ad968c7e > I will try the patch on Monday. (I did run the example on a single core CPU). Thanks for the quick feedback. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-05-02 18:48 ` Ronny Meeus @ 2015-05-05 6:04 ` Ronny Meeus 2015-05-06 9:41 ` Philippe Gerum 0 siblings, 1 reply; 9+ messages in thread From: Ronny Meeus @ 2015-05-05 6:04 UTC (permalink / raw) To: Philippe Gerum; +Cc: martin.bielik.sk, xenomai On Sat, May 2, 2015 at 8:48 PM, Ronny Meeus <ronny.meeus@gmail.com> wrote: >> This is a priority inversion issue caused by the handshake mechanism >> between the caller of t_delete() and the killed task finalizer. I >> eventually reproduced it after I figured out that pinning all tasks on >> the same CPU was required to trigger such bug. This patch should help: >> >> http://git.xenomai.org/xenomai-3.git/commit/?h=next&id=8431d7149405235fb0aebb53ed32a537ad968c7e >> > > I will try the patch on Monday. > (I did run the example on a single core CPU). > > Thanks for the quick feedback. Philippe, the patch seems to solve the issue. Thanks Just for my information, is there somewhere documentation about the remote agent? Ronny ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Xenomai] [xenomai-forge] Task blocked in t_delete 2015-05-05 6:04 ` Ronny Meeus @ 2015-05-06 9:41 ` Philippe Gerum 0 siblings, 0 replies; 9+ messages in thread From: Philippe Gerum @ 2015-05-06 9:41 UTC (permalink / raw) To: Ronny Meeus; +Cc: martin.bielik.sk, xenomai On 05/05/2015 08:04 AM, Ronny Meeus wrote: > On Sat, May 2, 2015 at 8:48 PM, Ronny Meeus <ronny.meeus@gmail.com> wrote: >>> This is a priority inversion issue caused by the handshake mechanism >>> between the caller of t_delete() and the killed task finalizer. I >>> eventually reproduced it after I figured out that pinning all tasks on >>> the same CPU was required to trigger such bug. This patch should help: >>> >>> http://git.xenomai.org/xenomai-3.git/commit/?h=next&id=8431d7149405235fb0aebb53ed32a537ad968c7e >>> >> >> I will try the patch on Monday. >> (I did run the example on a single core CPU). >> >> Thanks for the quick feedback. > > Philippe, > the patch seems to solve the issue. > Thanks > > Just for my information, is there somewhere documentation about the > remote agent? > No documentation so far. Basically it's an internal proxy thread for carrying out remote POSIX requests that are otherwise restricted to the local process. This only applies when --enable-pshared is in effect, and a multi-process application does remote thread control. So far we only need to proxy pthread_setschedparam() and pthread_cancel(). -- Philippe. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-05-06 9:41 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-04-30 8:14 [Xenomai] [xenomai-forge] Task blocked in t_delete Ronny Meeus 2015-04-30 10:01 ` Philippe Gerum 2015-04-30 12:39 ` Ronny Meeus 2015-04-30 13:09 ` Philippe Gerum 2015-04-30 13:55 ` Ronny Meeus 2015-05-01 16:55 ` Philippe Gerum 2015-05-02 18:48 ` Ronny Meeus 2015-05-05 6:04 ` Ronny Meeus 2015-05-06 9:41 ` Philippe Gerum
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.