Yes, I was able to duplicate both issues and attached is a patch which should 
fix them. Thanks again very much for the feedback, really appreciated!

Attached patch is based on httpd trunk r1629441. In this patch, the changes are:

1. Fix the graceful restart issue for prefork/worker/event MPM. 
2. Fix the "server seems busy" and "scoreboard is full" issue on restart for 
both worker and event MPM. Prefork does not have this issue.
3. Guard the ap_daemons_to_start >= num_buckets. I mentioned this in a separate 
mail thread couple days ago, I merged the change here.
4. Change CPU thread count check from _SC_NPROCESSORS_ONLN to 
_SC_NPROCESSORS_CONF. This makes sure num_buckets to be a constant as long as 
the system is running. This change addresses the use case like: A user offline 
some of the CPU threads and then restart httpd. In this case, I think we need 
to make sure num_buckets does not change during the restart. 

Kaspar, can you please test the patch and let us know if that resolves your 
issue? 

At the meantime, can some please review the patch and help add it into trunk?

Thanks,
Yingqi


-----Original Message-----
From: Lu, Yingqi [mailto:yingqi...@intel.com] 
Sent: Saturday, October 04, 2014 7:52 AM
To: dev@httpd.apache.org
Subject: RE: svn commit: r1599531 - in /httpd/httpd/trunk: CHANGES 
include/ap_listen.h server/listen.c server/mpm/event/event.c 
server/mpm/prefork/prefork.c server/mpm/worker/worker.c server/mpm_unix.c

Hi Kaspar,

Thanks for the email. I will try to duplicate your case and find a solution for 
it. 

Thanks,
Yingqi

-----Original Message-----
From: Kaspar Brand [mailto:httpd-dev.2...@velox.ch]
Sent: Saturday, October 04, 2014 4:08 AM
To: dev@httpd.apache.org
Subject: Re: svn commit: r1599531 - in /httpd/httpd/trunk: CHANGES 
include/ap_listen.h server/listen.c server/mpm/event/event.c 
server/mpm/prefork/prefork.c server/mpm/worker/worker.c server/mpm_unix.c

> Author: jim
> Date: Tue Jun  3 13:07:29 2014
> New Revision: 1599531
> 
> URL: http://svn.apache.org/r1599531
> Log:
> Optimize w/ duplicated listeners and use of SO_REUSEPORT where 
> available.
> 
> Modified:
>     httpd/httpd/trunk/CHANGES
>     httpd/httpd/trunk/include/ap_listen.h
>     httpd/httpd/trunk/server/listen.c
>     httpd/httpd/trunk/server/mpm/event/event.c
>     httpd/httpd/trunk/server/mpm/prefork/prefork.c
>     httpd/httpd/trunk/server/mpm/worker/worker.c
>     httpd/httpd/trunk/server/mpm_unix.c


With these changes, I'm getting segfaults with the worker MPM from current 
trunk (r1629257) when trying to gracefully restart, i.e. with SIGUSR1. 
"Standard" restarts (SIGHUP) seem to work better, though I'm getting "server 
seems busy" and "scoreboard is full" log entries and other errors in this case. 
A sample stack (CentOS 6 / x86_64) is shown below, in case it helps in tracking 
down the issue.

Kaspar


(gdb) bt f
#0  make_child (s=0x7f8b447c26f8, slot=0) at worker.c:1410
        pid = <value optimized out>
#1  0x00007f8b43342037 in server_main_loop (_pconf=<value optimized out>, 
plog=<value optimized out>,
    s=<value optimized out>) at worker.c:1742
        status = 0
        pid = {pid = 2188, in = 0x7f8b447c26f8, out = 0x7f8b44791138, err = 
0x7f8b42811993}
        i = <value optimized out>
        old_gen = 0
        child_slot = 0
        exitwhy = APR_PROC_EXIT
        processed_status = 0
#2  worker_run (_pconf=<value optimized out>, plog=<value optimized out>, 
s=<value optimized out>) at worker.c:1872
        remaining_children_to_start = 3
        rv = <value optimized out>
        i = <value optimized out>
#3  0x00007f8b432ffe7e in ap_run_mpm (pconf=0x7f8b44791138, 
plog=0x7f8b447be498, s=0x7f8b447c26f8)
    at mpm_common.c:100
        pHook = <value optimized out>
        n = <value optimized out>
        rv = -1
#4  0x00007f8b432f940e in main (argc=1, argv=0x7ffffbee4618) at main.c:799
        c = 0 '\000'
        showcompile = 0
        showdirectives = 1148776984
        confname = 0x7f8b433442ea "conf/httpd.conf"
        def_server_root = 0x7f8b433442d1 "/home/apache-httpd/trunk"
        temp_error_log = 0x0
        error = <value optimized out>
        process = 0x7f8b4478f218
        pconf = 0x7f8b44791138
        plog = 0x7f8b447be498
        ptemp = 0x7f8b447bc348
        pcommands = 0x7f8b447b3248
        opt = 0x7f8b447b3338
        rv = <value optimized out>
        mod = <value optimized out>
        opt_arg = 0x0
        signal_server = <value optimized out>

Attachment: httpd_trunk_SO_REUSEPORT_fix.patch
Description: httpd_trunk_SO_REUSEPORT_fix.patch

Reply via email to