* [Xenomai] latency.c: fix occasional SIGSEGV at shutdown when mode is USER_TASK
@ 2017-04-01 6:25 Josh Bowman
2017-04-01 9:16 ` Philippe Gerum
0 siblings, 1 reply; 2+ messages in thread
From: Josh Bowman @ 2017-04-01 6:25 UTC (permalink / raw)
To: xenomai
Hi,
Under Mercury, I've been seeing occasionally a "Segmentation fault" message
when I hit ctrl-c to stop the latency test program. I caught a core dump,
and the stack trace leads back to the sem_wait() call in the display task.
I think this is caused by the cleanup() routine destroying the semaphore
before it calls join on the display task. This patch seems to fix the issue.
-Josh
diff --git a/testsuite/latency/latency.c b/testsuite/latency/latency.c
index e800361..5304342 100644
--- a/testsuite/latency/latency.c
+++ b/testsuite/latency/latency.c
@@ -492,6 +492,8 @@ static void cleanup(void)
if (test_mode == USER_TASK) {
pthread_cancel(latency_task);
pthread_join(latency_task, NULL);
+ pthread_join(display_task, NULL);
+
sem_close(display_sem);
sem_unlink(sem_name);
gavgjitter /= (test_loops > 1 ? test_loops : 2) - 1;
@@ -504,10 +506,9 @@ static void cleanup(void)
gmaxjitter = overall.result.max;
gavgjitter = overall.result.avg;
goverrun = overall.result.overruns;
+ pthread_join(display_task, NULL);
}
- pthread_join(display_task, NULL);
-
if (benchdev >= 0)
close(benchdev);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Xenomai] latency.c: fix occasional SIGSEGV at shutdown when mode is USER_TASK
2017-04-01 6:25 [Xenomai] latency.c: fix occasional SIGSEGV at shutdown when mode is USER_TASK Josh Bowman
@ 2017-04-01 9:16 ` Philippe Gerum
0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2017-04-01 9:16 UTC (permalink / raw)
To: Josh Bowman, xenomai
On 04/01/2017 08:25 AM, Josh Bowman wrote:
> Hi,
>
> Under Mercury, I've been seeing occasionally a "Segmentation fault" message
> when I hit ctrl-c to stop the latency test program. I caught a core dump,
> and the stack trace leads back to the sem_wait() call in the display task.
>
> I think this is caused by the cleanup() routine destroying the semaphore
> before it calls join on the display task. This patch seems to fix the issue.
>
Good catch. Merged, thanks.
--
Philippe.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-01 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-01 6:25 [Xenomai] latency.c: fix occasional SIGSEGV at shutdown when mode is USER_TASK Josh Bowman
2017-04-01 9:16 ` 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.