some API about RT_TASK occur Segmentation fault
System configuration:
debian-8.6, 3.18.46-rt50
Xenomai/mercury v3.0.3
Build args: --with-core=mercury --enable-smp --enable-pshared
Now I am need help. Thanks.
-------- Forwarding messages --------
From: "[email protected]" <[email protected]>
Date: 2017-02-04 12:04:15
To: [email protected]
Subject: some API about RT_TASK occur Segmentation fault
Hi
During using API about RT_TASK I found some doubt.
1) rt_task_inquire(RT_TASK * task, RT_TASK_INFO * info ), if info is NULL will occur Segmentation fault, but in API reference this is valid.
http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__task.html#ga53bad6acf5496f8008e594954507dce8
2) After main task called rt_task_shadow(), program will create other tasks depend on request, but when create second task will occur Segmentation fault. Now main task don't call rt_task_shadow(), program will OK. I don't know why.
3) I write a demo which create the same task three times as follows:
#include <stdio.h>
#include <unistd.h>
#include <alchemy/task.h>RT_TASK task1;
void func(void *arg)
{
printf("enter func ...\n");
}
int main()
{
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); //rt_task_delete(&task1);
return 0;
}
When the third time create , program will occur Segmentation fault.
Quoted 45 lines · On 02/06/2017 02:30 AM, [email protected] wrote:
System configuration:
debian-8.6, 3.18.46-rt50
Xenomai/mercury v3.0.3
Build args: --with-core=mercury --enable-smp --enable-psharedNow I am need help. Thanks.
-------- Forwarding messages --------
From: "[email protected]" <[email protected]>
Date: 2017-02-04 12:04:15
To: [email protected]
Subject: some API aboutRT_TASKoccur Segmentation fault
Hi
During using API aboutRT_TASKI found some doubt.
1)rt_task_inquire(RT_TASK * task, RT_TASK_INFO * info ), if info is NULL will occur Segmentation fault, but in API reference this is valid.
http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__task.html#ga53bad6acf5496f8008e594954507dce82) After main task called
rt_task_shadow(), program will create other tasks depend on request, but when create second task will occur Segmentation fault.
Now main task don't callrt_task_shadow(), program will OK. I don't know why.3) I write a demo which create the same task three times as follows:
#include <stdio.h>
#include <unistd.h>
#include <alchemy/task.h>RT_TASKtask1;
voidfunc(void *arg)
{
printf("enter func ...\n");
}
intmain()
{
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); //rt_task_delete(&task1);
return 0;
}
Quoted 2 lines
When the third time create , program will occur Segmentation fault.
This bug was fixed in the stable branch some time ago:git://git.xenomai.org/xenomai-3.git, branch stable-3.0.x
Signature · 1 line
Philippe.
Thank you for help.
I had git clone git://git.xenomai.org/xenomai-3.git, compile and install it with:
./scripts/bootstrap
../xenomai-3/configure --with-core=mercury --enable-smp --enable-pshared --enable-debug=full
make installThen run my demo, but the result is the same as before :
----------------------------------------------------------------------------------------------------------
0"002.570| WARNING: [main] Xenomai compiled with full debug enabled,
very high latencies expected [--enable-debug=full]
enter func ...
enter func ...rt_task_create: ../../../xenomai-3/lib/copperplate/heapobj-pshared.c:452: alloc_block: Assertion `0' failed. Aborted
----------------------------------------------------------------------------------------------------------
Yesterday, I add some printf to alloc_block() of heapobj-pshared.c. I found that segmentaion fault occur when run to the line 455 "++extent->pagemap[pgnum].bcount;" . At this time the value of "heap->buckets[ilog].freelist" is very big.
Now I think whether my xenomai configuration or system environment have something wrong.
Besides, my system(x86_64bit) run in a 8 cores Oracle virtual machine, the host cpu is Inter(R) xeon(R) CPU E5-2630 v4 @ 2.20GHz. I don't know whether these information is useful.
Thanks in advance, best regards.
Quoted 54 lines · Philippe Gerum
Quoted 45 lines · On 02/06/2017 02:30 AM, [email protected] wrote:
System configuration:
debian-8.6, 3.18.46-rt50
Xenomai/mercury v3.0.3
Build args: --with-core=mercury --enable-smp --enable-psharedNow I am need help. Thanks.
-------- Forwarding messages --------
From: "[email protected]" <[email protected]>
Date: 2017-02-04 12:04:15
To: [email protected]
Subject: some API aboutRT_TASKoccur Segmentation fault
Hi
During using API aboutRT_TASKI found some doubt.
1)rt_task_inquire(RT_TASK * task, RT_TASK_INFO * info ), if info is NULL will occur Segmentation fault, but in API reference this is valid.
http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__task.html#ga53bad6acf5496f8008e594954507dce82) After main task called
rt_task_shadow(), program will create other tasks depend on request, but when create second task will occur Segmentation fault.
Now main task don't callrt_task_shadow(), program will OK. I don't know why.3) I write a demo which create the same task three times as follows:
#include <stdio.h>
#include <unistd.h>
#include <alchemy/task.h>RT_TASKtask1;
voidfunc(void *arg)
{
printf("enter func ...\n");
}
intmain()
{
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); //rt_task_delete(&task1);
return 0;
}Quoted 2 lines
When the third time create , program will occur Segmentation fault.
This bug was fixed in the stable branch some time ago:
git://git.xenomai.org/xenomai-3.git, branch stable-3.0.xSignature · 1 line
Philippe.
Just now when I compiling xenomai, removed "--enable-pshared" configuration option. My demo is normal finally, and print out third sentence "enter func ..." without segmentaion fault. Although the question is solved temporarily , but still don't know the reason. So I'm still worried about my system environment have some problems.
Thanks again, best regards.
发自网易邮箱大师
在2017年02月07日 14:18,[email protected] 写道:
Thank you for help.
I had git clone git://git.xenomai.org/xenomai-3.git, compile and install it with:
./scripts/bootstrap
../xenomai-3/configure --with-core=mercury --enable-smp --enable-pshared --enable-debug=full
make installThen run my demo, but the result is the same as before :
----------------------------------------------------------------------------------------------------------
0"002.570| WARNING: [main] Xenomai compiled with full debug enabled,
very high latencies expected [--enable-debug=full]
enter func ...
enter func ...rt_task_create: ../../../xenomai-3/lib/copperplate/heapobj-pshared.c:452: alloc_block: Assertion `0' failed. Aborted
----------------------------------------------------------------------------------------------------------
Yesterday, I add some printf to alloc_block() of heapobj-pshared.c. I found that segmentaion fault occur when run to the line 455 "++extent->pagemap[pgnum].bcount;" . At this time the value of "heap->buckets[ilog].freelist" is very big.
Now I think whether my xenomai configuration or system environment have something wrong.
Besides, my system(x86_64bit) run in a 8 cores Oracle virtual machine, the host cpu is Inter(R) xeon(R) CPU E5-2630 v4 @ 2.20GHz. I don't know whether these information is useful.
Thanks in advance, best regards.
Quoted 54 lines · Philippe Gerum
Quoted 45 lines · On 02/06/2017 02:30 AM, [email protected] wrote:
System configuration:
debian-8.6, 3.18.46-rt50
Xenomai/mercury v3.0.3
Build args: --with-core=mercury --enable-smp --enable-psharedNow I am need help. Thanks.
-------- Forwarding messages --------
From: "[email protected]" <[email protected]>
Date: 2017-02-04 12:04:15
To: [email protected]
Subject: some API aboutRT_TASKoccur Segmentation fault
Hi
During using API aboutRT_TASKI found some doubt.
1)rt_task_inquire(RT_TASK * task, RT_TASK_INFO * info ), if info is NULL will occur Segmentation fault, but in API reference this is valid.
http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__task.html#ga53bad6acf5496f8008e594954507dce82) After main task called
rt_task_shadow(), program will create other tasks depend on request, but when create second task will occur Segmentation fault.
Now main task don't callrt_task_shadow(), program will OK. I don't know why.3) I write a demo which create the same task three times as follows:
#include <stdio.h>
#include <unistd.h>
#include <alchemy/task.h>RT_TASKtask1;
voidfunc(void *arg)
{
printf("enter func ...\n");
}
intmain()
{
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); sleep(1);
rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); //rt_task_delete(&task1);
return 0;
}Quoted 2 lines
When the third time create , program will occur Segmentation fault.
This bug was fixed in the stable branch some time ago:
git://git.xenomai.org/xenomai-3.git, branch stable-3.0.xSignature · 1 line
Philippe.
Quoted 3 lines · On 02/07/2017 03:19 PM, [email protected] wrote:
Just now when I compiling xenomai, removed "--enable-pshared" configuration option. My demo is normal finally, and print out third sentence "enter func ..." without segmentaion fault.
I believe that you are not using the right code. Did you pull the code from the stable-3.0.x branch as mentioned earlier?
If you did so, you should see this output when passing the --version switch to your program:
based on Xenomai/mercury v3.0.3 -- #00e3d01 (2017-01-27 10:16:11 +0100)
Quoted 104 lines
Although the question is solved temporarily , but still don't know the reason. So I'm still worried about my system environment have some problems.
Thanks again, best regards.
发自网易邮箱大师
在2017年02月07日 14:18,[email protected] <mailto:[email protected]> 写道: Thank you for help. I had git clone git://git.xenomai.org/xenomai-3.git, compile and install it with: ./scripts/bootstrap ../xenomai-3/configure --with-core=mercury --enable-smp --enable-pshared --enable-debug=full make install Then run my demo, but the result is the same as before : ---------------------------------------------------------------------------------------------------------- 0"002.570| WARNING: [main] Xenomai compiled with full debug enabled, very high latencies expected [--enable-debug=full] enter func ... enter func ... rt_task_create: ../../../xenomai-3/lib/copperplate/heapobj-pshared.c:452: alloc_block: Assertion `0' failed. Aborted ---------------------------------------------------------------------------------------------------------- Yesterday, I add some printf to alloc_block() of heapobj-pshared.c. I found that segmentaion fault occur when run to the line 455 "++extent->pagemap[pgnum].bcount;" . At this time the value of "heap->buckets[ilog].freelist" is very big. Now I think whether my xenomai configuration or system environment have something wrong. Besides, my system(x86_64bit) run in a 8 cores Oracle virtual machine, the host cpu is Inter(R) xeon(R) CPU E5-2630 v4 @ 2.20GHz. I don't know whether these information is useful. Thanks in advance, best regards. At 2017-02-06 21:50:13, "Philippe Gerum" <[email protected] <mailto:[email protected]>> wrote: >On 02/06/2017 02:30 AM, [email protected] <mailto:[email protected]> wrote: >> System configuration: >> debian-8.6, 3.18.46-rt50 >> Xenomai/mercury v3.0.3 >> Build args: --with-core=mercury --enable-smp --enable-pshared >> >> Now I am need help. Thanks. >> >> >> -------- Forwarding messages -------- >> From: "[email protected] <mailto:[email protected]>" <[email protected] <mailto:[email protected]>> >> Date: 2017-02-04 12:04:15 >> To: [email protected] <mailto:[email protected]> >> Subject: some API about RT_TASK occur Segmentation fault >> Hi >> During using API about RT_TASK I found some doubt. >> 1) rt_task_inquire(RT_TASK * task, RT_TASK_INFO * info ), if info is >> NULL will occur Segmentation fault, but in API reference this is valid. >> http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__task.html#ga53bad6acf5496f8008e594954507dce8 >> >> 2) After main task called rt_task_shadow(), program will create other >> tasks depend on request, but when create second task will occur >> Segmentation fault. >> Now main task don't call rt_task_shadow(), program will OK. I don't >> know why. >> >> 3) I write a demo which create the same task three times as follows: >> #include <stdio.h> >> #include <unistd.h> >> #include <alchemy/task.h> >> RT_TASK task1; >> void func(void *arg) >> { >> printf("enter func ...\n"); >> } >> int main() >> { >> rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); >> sleep(1); >> rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); >> sleep(1); >> rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); >> //rt_task_delete(&task1); >> return 0; >> } >> >> When the third time create , program will occur Segmentation fault. >> > >This bug was fixed in the stable branch some time ago: >git://git.xenomai.org/xenomai-3.git, branch stable-3.0.x > >-- >Philippe.
Signature · 1 line
Philippe.
Philippe,
Thank you very much.Exactly as you say, the reason is that my code isn't lastest.
Best regards.
Quoted 121 lines · Philippe Gerum
Quoted 3 lines · On 02/07/2017 03:19 PM, [email protected] wrote:
Just now when I compiling xenomai, removed "--enable-pshared" configuration option. My demo is normal finally, and print out third sentence "enter func ..." without segmentaion fault.
I believe that you are not using the right code. Did you pull the code from the stable-3.0.x branch as mentioned earlier?
If you did so, you should see this output when passing the --version switch to your program:
based on Xenomai/mercury v3.0.3 -- #00e3d01 (2017-01-27 10:16:11 +0100)
Quoted 104 lines
Although the question is solved temporarily , but still don't know the reason. So I'm still worried about my system environment have some problems.
Thanks again, best regards.
发自网易邮箱大师
在2017年02月07日 14:18,[email protected] <mailto:[email protected]> 写道: Thank you for help. I had git clone git://git.xenomai.org/xenomai-3.git, compile and install it with: ./scripts/bootstrap ../xenomai-3/configure --with-core=mercury --enable-smp --enable-pshared --enable-debug=full make install Then run my demo, but the result is the same as before : ---------------------------------------------------------------------------------------------------------- 0"002.570| WARNING: [main] Xenomai compiled with full debug enabled, very high latencies expected [--enable-debug=full] enter func ... enter func ... rt_task_create: ../../../xenomai-3/lib/copperplate/heapobj-pshared.c:452: alloc_block: Assertion `0' failed. Aborted ---------------------------------------------------------------------------------------------------------- Yesterday, I add some printf to alloc_block() of heapobj-pshared.c. I found that segmentaion fault occur when run to the line 455 "++extent->pagemap[pgnum].bcount;" . At this time the value of "heap->buckets[ilog].freelist" is very big. Now I think whether my xenomai configuration or system environment have something wrong. Besides, my system(x86_64bit) run in a 8 cores Oracle virtual machine, the host cpu is Inter(R) xeon(R) CPU E5-2630 v4 @ 2.20GHz. I don't know whether these information is useful. Thanks in advance, best regards. At 2017-02-06 21:50:13, "Philippe Gerum" <[email protected] <mailto:[email protected]>> wrote: >On 02/06/2017 02:30 AM, [email protected] <mailto:[email protected]> wrote: >> System configuration: >> debian-8.6, 3.18.46-rt50 >> Xenomai/mercury v3.0.3 >> Build args: --with-core=mercury --enable-smp --enable-pshared >> >> Now I am need help. Thanks. >> >> >> -------- Forwarding messages -------- >> From: "[email protected] <mailto:[email protected]>" <[email protected] <mailto:[email protected]>> >> Date: 2017-02-04 12:04:15 >> To: [email protected] <mailto:[email protected]> >> Subject: some API about RT_TASK occur Segmentation fault >> Hi >> During using API about RT_TASK I found some doubt. >> 1) rt_task_inquire(RT_TASK * task, RT_TASK_INFO * info ), if info is >> NULL will occur Segmentation fault, but in API reference this is valid. >> http://www.xenomai.org/documentation/xenomai-3/html/xeno3prm/group__alchemy__task.html#ga53bad6acf5496f8008e594954507dce8 >> >> 2) After main task called rt_task_shadow(), program will create other >> tasks depend on request, but when create second task will occur >> Segmentation fault. >> Now main task don't call rt_task_shadow(), program will OK. I don't >> know why. >> >> 3) I write a demo which create the same task three times as follows: >> #include <stdio.h> >> #include <unistd.h> >> #include <alchemy/task.h> >> RT_TASK task1; >> void func(void *arg) >> { >> printf("enter func ...\n"); >> } >> int main() >> { >> rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); >> sleep(1); >> rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); >> sleep(1); >> rt_task_spawn(&task1, "task1", 0, 80, 0, func, NULL); >> //rt_task_delete(&task1); >> return 0; >> } >> >> When the third time create , program will occur Segmentation fault. >> > >This bug was fixed in the stable branch some time ago: >git://git.xenomai.org/xenomai-3.git, branch stable-3.0.x > >-- >Philippe.Signature · 1 line
Philippe.