Bug 554914

Summary: restarting nginx via /etc/init.d/nginx script fails
Product: [Fedora] Fedora EPEL Reporter: grothe
Component: nginxAssignee: Jeremy Hinegardner <jeremy>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: el5CC: jeremy
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: nginx-0.6.39-4.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-08 20:20:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description grothe 2010-01-13 00:52:40 UTC
Description of problem:
Issuing a restart command for the nginx daemon via the /etc/init.d/nginx script results in a crash.


Version-Release number of selected component (if applicable):
nginx.x86_64                               0.6.39-2.el5                installed
Linux XXXXXX 2.6.18-128.1.10.el5 #1 SMP Thu May 7 10:35:59 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux


How reproducible:
Every Time

Steps to Reproduce:
1. > /etc/init.d/nginx restart


Actual results:
    > /etc/init.d/nginx restart
    2010/01/12 16:28:43 [info] 10263#0: the configuration file /etc/nginx/nginx.conf was tested successfully
    Stopping nginx:                                            [  OK  ]
    Starting nginx:

    "Hey, where's my OK?"
    Log file shows "panic: MUTEX_LOCK (22) [op.c:352]."


    "Maybe a bad config?"
    > /etc/init.d/nginx start
    Starting nginx:                                            [  OK  ]

    "Nope, starts just fine"

  Expected results:
    nginx daemon should restart successfully.
    > /etc/init.d/nginx restart
    Stopping nginx:                                            [  OK  ]
    Starting nginx:                                            [  OK  ]


  Additional info:

    The MUTEX_LOCK error is interesting. Seems to be an issue with the daemon starting up before the cleanup is complete.

    Simple workaround until the root cause is identified is to insert a sleep in the restart section of the init script.
    Even a 1 second sleep is enough to avoid the MUTEX_LOCK issue:

    -/etc/init/d/nginx-
    ----------------------
    ...
    restart() {
        configtest || return $?
        stop
        # wait for cleanup to complete
        sleep 1
        start
    }
    ...
    ----------------------

Comment 1 Jeremy Hinegardner 2010-02-16 05:04:07 UTC
Looks like this is really caused by the embedded perl module and its shutdown.  Googling "MUTEX_LOCK (22) [op.c:352]" brings up lots of results.

It is further exacerbated becuse the init script is using -QUIT for graceful shutdown of the nginx server, which does not wait for it to die.  It is probably better to let it do the quick shutdown with the standard -TERM followed by -KILL. 

This only affects 0.6.39 on EL-5 and EL-4.  I'm updating the init script and pushing out a new release.

Comment 2 Fedora Update System 2010-02-17 16:48:37 UTC
nginx-0.6.39-4.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/nginx-0.6.39-4.el5

Comment 3 Fedora Update System 2010-02-17 16:48:42 UTC
nginx-0.6.39-4.el4 has been submitted as an update for Fedora EPEL 4.
http://admin.fedoraproject.org/updates/nginx-0.6.39-4.el4

Comment 4 Fedora Update System 2010-02-18 07:33:38 UTC
nginx-0.6.39-4.el4 has been pushed to the Fedora EPEL 4 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update nginx'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/EL-4/FEDORA-EPEL-2010-0237

Comment 5 Fedora Update System 2010-02-18 07:34:00 UTC
nginx-0.6.39-4.el5 has been pushed to the Fedora EPEL 5 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update nginx'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/EL-5/FEDORA-EPEL-2010-0244

Comment 6 Fedora Update System 2010-03-08 20:20:50 UTC
nginx-0.6.39-4.el4 has been pushed to the Fedora EPEL 4 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2010-03-08 20:22:36 UTC
nginx-0.6.39-4.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.