View Issue Details

IDProjectCategoryView StatusLast Update
0000700Apache 2.x Bugpublic2019-11-01 17:54
ReporterSteven Levine Assigned ToSteven Levine  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformOS2/eCSOSOS/2 or eComstationOS Version1.x 2.x or 4.5
Fixed in Version2.4.x 
Summary0000700: apache 2.4.38 httpd.exe crashes on exit.
DescriptionThis appears to be some sort of recursion that eventually blow the stack.

Please provide a debug build and I will track this down.

It might be useful to update the Mantis configuration to include 2.4.x. It's probably sufficient to edit the current project title and add version identifiers such as 2.4.38.
TagsNo tags attached.
Attached Files

Relationships

has duplicate 0000693 closedSteven Levine Bug in terminate Apache 2.4.38 

Activities

psmedley

2019-10-22 08:41

administrator   ~0003358

http://smedley.id.au/tmp/httpd-2.4.41-os2-debug-20191022.zip

Steven Levine

2019-10-27 02:11

manager   ~0003359

The exit loop is the result of the debug code added after 2.4.35. to track down the source of the ERROR_SEM_OWNER_DIED problems.

The code overwrites the return from master-main() and has the side effect of setting the return code to 0, so mpmt_os2_run() loops until pthreads is given a NULL mutex and we trap.

The attached diff should fix this. The debug code is modifed to use rc2 rather than rc.

The diff is against your 2.4.28 sources, but should apply cleanly to your 2.4.41 sources because all the line numbers matched up in the debugger.
mpmt_os2.c.diff (2,078 bytes)   
diff --git a/server/mpm/mpmt_os2/mpmt_os2.c b/server/mpm/mpmt_os2/mpmt_os2.c
index 720f469..74ed1db 100644
--- a/server/mpm/mpmt_os2/mpmt_os2.c
+++ b/server/mpm/mpmt_os2/mpmt_os2.c
@@ -208,26 +208,27 @@ static int mpmt_os2_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
         ap_scoreboard_image->global->running_generation = ap_my_generation;
 
         if (rc != OK) {
+            ULONG rc2;
             ap_remove_pid(pconf, ap_pid_fname);
 #if 1
-            rc = DosQueryMutexSem(ap_mpm_accept_mutex,
+            rc2 = DosQueryMutexSem(ap_mpm_accept_mutex,
                                    &pidSemaphoreOwner,
                                    &tidSemaphoreOwner,
                                    &ulRequestCount);
             // 2013-03-24 SHL was APLOG_INFO
-            if (rc == 0)
+            if (rc2 == 0)
                 ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS,
                              ap_server_conf, "pidSemaphoreOwner = %d, tidSemaphoreOwner = %d, ulRequestCount = %ul",
                              pidSemaphoreOwner, tidSemaphoreOwner, ulRequestCount);
 
             // 2013-03-24 SHL
-            else if (rc == ERROR_SEM_OWNER_DIED)
-                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc),
+            else if (rc2 == ERROR_SEM_OWNER_DIED)
+                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc2),
                              ap_server_conf, "Sem owner died pidSemaphoreOwner = %d, tidSemaphoreOwner = %d, ulRequestCount = %ul",
                              pidSemaphoreOwner, tidSemaphoreOwner, ulRequestCount);
             else
-                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), s,
-                             "DosQueryMutexSem returned %d", rc);
+                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc2), s,
+                             "DosQueryMutexSem returned %d", rc2);
 #endif
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00201)
                          "caught %s, shutting down",
mpmt_os2.c.diff (2,078 bytes)   

psmedley

2019-10-27 04:53

administrator   ~0003360

http://smedley.id.au/tmp/httpd-2.4.41-os2-debug-20191027.zip contains updated binaries.

note: I haven't tested these as yet, got a few other things on right now.

Thanks for the diff

Steven Levine

2019-10-27 15:10

manager   ~0003361

Thanks for the build. It resolves the shutdown trap. Time for some stress testing. I am also going to look at the graceful shutdown tweaks we discussed.

Steven Levine

2019-10-27 18:35

manager   ~0003362

Here's a diff that should apply with

  git apply

The problem with the previous patch is that it was built with

  git diff -w

This makes the patch more readable when I am using the diff to inspect changes.

However in cases where the change to a line is whitespace only, git apply will fail because line will be shown as a context line rather than a change line. This is what happened here because I added whitespace to keep the parameters lined up.

There is a workaround

  git apply --ignore-whitespace

will allow context lines that differ by whitespace to match and the patch will apply. However, this leaves the parameters unaligned so it's not the preferred solution.

For the future, if a patch I provide fails to apply, ask me if I neglected to suppress the -w when preparing the patch.

This problem is not specific to git diff, it can occur for diffs prepared by svn diff or diff.exe. However, I am less likely to omit the -w because the switch is reported along with the other diff options. The does happen for diffs prepared by git.
mpmt_os2.c.diff-Z (2,241 bytes)   
diff --git a/server/mpm/mpmt_os2/mpmt_os2.c b/server/mpm/mpmt_os2/mpmt_os2.c
index 720f469..74ed1db 100644
--- a/server/mpm/mpmt_os2/mpmt_os2.c
+++ b/server/mpm/mpmt_os2/mpmt_os2.c
@@ -208,26 +208,27 @@ static int mpmt_os2_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
         ap_scoreboard_image->global->running_generation = ap_my_generation;
 
         if (rc != OK) {
+            ULONG rc2;
             ap_remove_pid(pconf, ap_pid_fname);
 #if 1
-            rc = DosQueryMutexSem(ap_mpm_accept_mutex,
-                                  &pidSemaphoreOwner,
-                                  &tidSemaphoreOwner,
-                                  &ulRequestCount);
+            rc2 = DosQueryMutexSem(ap_mpm_accept_mutex,
+                                   &pidSemaphoreOwner,
+                                   &tidSemaphoreOwner,
+                                   &ulRequestCount);
             // 2013-03-24 SHL was APLOG_INFO
-            if (rc == 0)
+            if (rc2 == 0)
                 ap_log_error(APLOG_MARK, APLOG_INFO, APR_SUCCESS,
                              ap_server_conf, "pidSemaphoreOwner = %d, tidSemaphoreOwner = %d, ulRequestCount = %ul",
                              pidSemaphoreOwner, tidSemaphoreOwner, ulRequestCount);
 
             // 2013-03-24 SHL
-            else if (rc == ERROR_SEM_OWNER_DIED)
-                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc),
+            else if (rc2 == ERROR_SEM_OWNER_DIED)
+                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc2),
                              ap_server_conf, "Sem owner died pidSemaphoreOwner = %d, tidSemaphoreOwner = %d, ulRequestCount = %ul",
                              pidSemaphoreOwner, tidSemaphoreOwner, ulRequestCount);
             else
-                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc), s,
-                             "DosQueryMutexSem returned %d", rc);
+                ap_log_error(APLOG_MARK, APLOG_ERR, APR_FROM_OS_ERROR(rc2), s,
+                             "DosQueryMutexSem returned %d", rc2);
 #endif
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00201)
                          "caught %s, shutting down",
mpmt_os2.c.diff-Z (2,241 bytes)   

Steven Levine

2019-10-31 21:28

manager   ~0003363

If there are no objection, I will resolve this ticket.

psmedley

2019-10-31 22:59

administrator   ~0003364

no objection from me. Apologies, it's been a busy week, I'd intended to get back to this ticket today as I have the day off, but you beat me to it :)

Steven Levine

2019-11-01 17:53

manager   ~0003370

Issue resolved by included patch.

Issue History

Date Modified Username Field Change
2019-10-20 06:23 Steven Levine New Issue
2019-10-20 06:23 Steven Levine Status new => assigned
2019-10-20 06:23 Steven Levine Assigned To => Steven Levine
2019-10-22 08:41 psmedley Note Added: 0003358
2019-10-27 02:11 Steven Levine File Added: mpmt_os2.c.diff
2019-10-27 02:11 Steven Levine Note Added: 0003359
2019-10-27 04:53 psmedley Note Added: 0003360
2019-10-27 15:10 Steven Levine Note Added: 0003361
2019-10-27 18:35 Steven Levine File Added: mpmt_os2.c.diff-Z
2019-10-27 18:35 Steven Levine Note Added: 0003362
2019-10-31 21:28 Steven Levine Note Added: 0003363
2019-10-31 22:59 psmedley Note Added: 0003364
2019-11-01 02:08 Steven Levine Relationship added related to 0000693
2019-11-01 02:09 Steven Levine Relationship replaced has duplicate 0000693
2019-11-01 17:53 Steven Levine Status assigned => closed
2019-11-01 17:53 Steven Levine Resolution open => fixed
2019-11-01 17:53 Steven Levine Fixed in Version => 2.4.x
2019-11-01 17:53 Steven Levine Note Added: 0003370