You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2012/12/16 04:08:11 UTC

[Bug 54311] New: The return error is never checked for inappropriate ThreadStackSize

https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

            Bug ID: 54311
           Summary: The return error is never checked for inappropriate
                    ThreadStackSize
           Product: Apache httpd-2
           Version: 2.4.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mpm_event
          Assignee: bugs@httpd.apache.org
          Reporter: tixu@cs.ucsd.edu
    Classification: Unclassified

Created attachment 29768
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29768&action=edit
patch to check the return value and print the error setting

Hi, 

In both mpm_event and mpm_worker, the error return of inappropriate
ThreadStackSize setting is not checked and printed out. This brings difficult
to users who wants to set small ThreadStackSize. In my case, I cannot easily
know whether the my setting is accepted or not without any log message.

The code is shown as follows:
/*
   server/mpm/event/event.c
   server/mpm/worker/worker.c
*/
if (ap_thread_stacksize != 0) {
    apr_threadattr_stacksize_set(thread_attr, ap_thread_stacksize);
}

The return value of apr_threadattr_stacksize_set() tells whether the setting is
valid or not. But the current code does not check the return value.

I suggest to add a patch to check the return value and print out an error
message, as follows (the patch is tested).

     if (ap_thread_stacksize != 0) {
-        rv = apr_threadattr_stacksize_set(thread_attr, ap_thread_stacksize);
-        if(rv != APR_SUCCESS) {
-            ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL,
APLOGNO(00522)
-                         "WARNING: ThreadStackSize of %ld is inappropriate,
change back to the default", 
-                         ap_thread_stacksize);
-        }
+        apr_threadattr_stacksize_set(thread_attr, ap_thread_stacksize);
     }   

The only thing I'm not sure is the APLOGNO. I don't know the rule of the number
assignment. And it seems that adding a log message will break the sequential
APLOGNO series.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

Tianyin Xu <ti...@cs.ucsd.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ErrorMessage                |
           Priority|P2                          |P1
           Severity|normal                      |major

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

Graham Leggett <mi...@sharp.fm> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Graham Leggett <mi...@sharp.fm> ---
Backported to v2.4.5.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

Christophe JAILLET <ch...@wanadoo.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk,
                   |                            |PatchAvailable

--- Comment #5 from Christophe JAILLET <ch...@wanadoo.fr> ---
Applied a slightly modified version to trunk.
r1433682

If nobody complains, I'll propose it for backport in 2.4.x branch.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

--- Comment #6 from Graham Leggett <mi...@sharp.fm> ---
Proposed for backport to v2.4.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

Tianyin Xu <ti...@cs.ucsd.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29769|0                           |1
        is obsolete|                            |

--- Comment #2 from Tianyin Xu <ti...@cs.ucsd.edu> ---
Created attachment 29770
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29770&action=edit
Please refer to this patch, thanks!

Here is the correct one. I write it based on the SendBufferSize checker.

The old patches are obsolete because it does not consider return value could be
APR_ENOTIMPL. Please refer to this one.

Thanks a lot!

-        apr_threadattr_stacksize_set(thread_attr, ap_thread_stacksize);
+        rv = apr_threadattr_stacksize_set(thread_attr, ap_thread_stacksize);
+        if(rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
+            ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_STARTUP, 0, NULL,
APLOGNO(00522)
+                         "WARNING: ThreadStackSize of %ld is inappropriate,
using default", 
+                         ap_thread_stacksize);
+        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

--- Comment #3 from Christophe JAILLET <ch...@wanadoo.fr> ---
Thanks for the patch.

Looks reasonable.

Another place where the return value of 'apr_threadattr_stacksize_set' is not
checked can be found on trunk in 'server/mpm/eventopt/eventopt.c' at line 2225

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

Tianyin Xu <ti...@cs.ucsd.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29768|0                           |1
        is obsolete|                            |

--- Comment #1 from Tianyin Xu <ti...@cs.ucsd.edu> ---
Created attachment 29769
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=29769&action=edit
patch to check the return value and print the error setting

I update my patch. Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

Tianyin Xu <ti...@cs.ucsd.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ErrorMessage
                 CC|                            |tixu@cs.ucsd.edu

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 54311] The return error is never checked for inappropriate ThreadStackSize

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54311

--- Comment #4 from Tianyin Xu <ti...@cs.ucsd.edu> ---
Thanks a lot, Christophe.

But I don't find the file, i.e., 'server/mpm/eventopt/eventopt.c' in my source
directory (actually I even don't have the eventopt directory). 

Is it new in trunk (compared with my stable version)?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org