httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54311] New: The return error is never checked for inappropriate ThreadStackSize
Date Sun, 16 Dec 2012 03:08:11 GMT
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


Mime
View raw message