View Issue Details

IDProjectCategoryView StatusLast Update
0004884libmicrohttpdportabilitypublic2021-09-02 17:54
Reportertomasheran Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformx86OSSolarisOS Version11.next
Product Version0.9.52 
Target Version0.9.53Fixed in Version0.9.53 
Summary0004884: pthread_kill(pid, 0) never returns ESRCH on Solaris 11.next
Descriptionsrc/testcurl/perf_get_concurrent.c depends on pthread_kill(pid, 0) to return ESRCH to detect that given thread finished. On Solaris 11.next, pthread_kill(...) doesn't return ESRCH unless given thread has been detached initially or joined/cancelled.
Additional InformationThis simple fix seems to deal with the issue:

--- a/src/testcurl/perf_get_concurrent.c Fri Oct 21 16:28:03 2016 +0200
+++ b/src/testcurl/perf_get_concurrent.c Fri Feb 03 14:25:16 2017 +0100
@@ -330,6 +330,11 @@
       MHD_stop_daemon(d);
       return 512;
     }
+ if (0 != pthread_detach(pid))
+ {
+ MHD_stop_daemon(d);
+ return 512;
+ }
   start_timer ();
   while (ESRCH != pthread_kill (pid, 0))
     {
TagsNo tags attached.

Activities

tomasheran

2017-02-07 12:35

reporter   ~0011700

It seems I was a bit too quick with my "fix", which solves the pthread_kill/ESRCH issue, but might cause problems trying to join already detached thread and could eventually cause SIGSEGV trying to fprintf() ret_val, that has never been initialized.

alanc

2017-02-12 01:00

reporter   ~0011714

Note that this change in Solaris was triggered by the POSIX / UNIX standards
committee ("The Austin Group") clarifying the standard to require this, so
this may affect other platforms as they adjust to comply as well.

This was done via:
http://austingroupbugs.net/view.php?id=765
http://austingroupbugs.net/view.php?id=792

Christian Grothoff

2017-02-12 09:47

manager   ~0011719

Pushed a better fix in 2e826fb4..648b65aa that uses a volatile to avoid the ESRCH-issue entirely, even without detach.

Christian Grothoff

2021-09-02 17:54

manager   ~0018185

Fix committed to master branch.

Related Changesets

libmicrohttpd: master 2e826fb4

2017-02-12 10:42

Christian Grothoff


Details Diff
fix 0004884 Affected Issues
0004884
mod - src/testcurl/perf_get_concurrent.c Diff File

Issue History

Date Modified Username Field Change
2017-02-07 11:26 tomasheran New Issue
2017-02-07 12:35 tomasheran Note Added: 0011700
2017-02-12 01:00 alanc Note Added: 0011714
2017-02-12 09:42 Christian Grothoff Assigned To => Christian Grothoff
2017-02-12 09:42 Christian Grothoff Status new => resolved
2017-02-12 09:42 Christian Grothoff Resolution open => fixed
2017-02-12 09:42 Christian Grothoff Fixed in Version => 0.9.53
2017-02-12 09:47 Christian Grothoff Note Added: 0011719
2017-02-12 09:48 Christian Grothoff Target Version => 0.9.53
2017-04-12 00:00 Christian Grothoff Status resolved => closed
2021-09-02 17:54 Christian Grothoff Changeset attached => libmicrohttpd master 2e826fb4
2021-09-02 17:54 Christian Grothoff Note Added: 0018185