You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Wendall Cada (Created) (JIRA)" <ji...@apache.org> on 2012/03/27 20:10:30 UTC

[jira] [Created] (COUCHDB-1449) Couchdb returns stopped status before process exits

Couchdb returns stopped status before process exits
---------------------------------------------------

                 Key: COUCHDB-1449
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
             Project: CouchDB
          Issue Type: Bug
    Affects Versions: 1.1.1, 1.0.3, 1.2, 1.3
         Environment: *NIX
            Reporter: Wendall Cada
             Fix For: 1.0.4, 1.2.1, 1.1.2


When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Newson updated COUCHDB-1449:
-----------------------------------

    Fix Version/s:     (was: 1.1.2)
                       (was: 1.0.4)

Removing 1.0.4/1.1.2.
                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.2.1
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch, couchdb-0007-wait-for-couch-stop.patch, use-sname-rpc-not-kill.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Wendall Cada (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wendall Cada updated COUCHDB-1449:
----------------------------------

    Attachment: couchdb-0007-wait-for-couch-stop.patch

Correct patch.
                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.0.4, 1.2.1, 1.1.2
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch, couchdb-0007-wait-for-couch-stop.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Wendall Cada (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239794#comment-13239794 ] 

Wendall Cada commented on COUCHDB-1449:
---------------------------------------

This is a much better patch. Thanks Sam.
                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.0.4, 1.2.1, 1.1.2
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch, couchdb-0007-wait-for-couch-stop.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Wendall Cada (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wendall Cada updated COUCHDB-1449:
----------------------------------

    Attachment: couchdb-0007-wait-for-couch-stop.patch

Patch to wait until process exits before returning success on shutdown.
                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.0.4, 1.2.1, 1.1.2
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Wendall Cada (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239795#comment-13239795 ] 

Wendall Cada commented on COUCHDB-1449:
---------------------------------------

The Debian patch would need to be reworked a bit, but I like the approach of checking for the parent heart process and waiting until it exits before returning a success. However, I don't know if it's overkill, or if it even matters.
                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.0.4, 1.2.1, 1.1.2
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch, couchdb-0007-wait-for-couch-stop.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Wendall Cada (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wendall Cada updated COUCHDB-1449:
----------------------------------

    Attachment: use-sname-rpc-not-kill.patch

Patch using sname and rpc halt() instead of kill -1
                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.0.4, 1.2.1, 1.1.2
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch, couchdb-0007-wait-for-couch-stop.patch, use-sname-rpc-not-kill.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Wendall Cada (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13240323#comment-13240323 ] 

Wendall Cada commented on COUCHDB-1449:
---------------------------------------

See: use-sname-rpc-not-kill.patch

Here is what I figured out while testing. The whole concept of using a PID file and kill -1 $PID with erlang is just not going to work consistently.

Here is a way to replicate what happens sometimes when issuing a restart (stop/start), and beam hasn't stopped yet.

For example, try: couchdb -b && couchdb -d && couchdb -b
Apache CouchDB has started, time to relax.
Apache CouchDB is not running.
Apache CouchDB has started, time to relax.
$ echo `cat /var/run/couchdb/couchdb.pid`
10229
$ ps -A | grep beam.smp
10193 pts/2    00:00:00 beam.smp

However, adding -sname couchdb to the command options results the second start failing silently, but couchdb does stop. A stale pid id is left in the pid file from the second start command.

Now if I modified start_couchdb so it actually checks if the process id returned from the erl command is running, then wait 2 seconds so the pid file can hit the disk. I modified stop_couchdb and eliminated the use of kill -1 and wait for the process to actually exit. Now everything works as intended, no matter what bizarre scenario is encountered.

So for just pure stupid, I can do this: 
for i in {1..5} ; do couchdb -d; couchdb -b ; done
The last command is a start and sure enough, couchdb is running and has restarted completely five times.
Same stupid in reverse:
for i in {1..5} ; do couchdb -b; couchdb -d ; done
CouchDB is stopped.

Now clearly there is going to be an issue with the use of sname and multiple couchdb instances up and running, but I think it will be worthwhile to fix. Every single resource I read and my own experience with erlang is that using kill to shut down is just waiting for problems.

I've temporarily appended the pid to start and stop messages for clarity on what's happening.







                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.0.4, 1.2.1, 1.1.2
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch, couchdb-0007-wait-for-couch-stop.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (COUCHDB-1449) Couchdb returns stopped status before process exits

Posted by "Sam Bisbee (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-1449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239785#comment-13239785 ] 

Sam Bisbee commented on COUCHDB-1449:
-------------------------------------

FYI, this issue was found and resolved in the Debian package a while ago (v0.10.1-2). Here's a link to the patch file: http://patch-tracker.debian.org/patch/series/view/couchdb/0.11.0-2.3/init.patch

Cheers.
                
> Couchdb returns stopped status before process exits
> ---------------------------------------------------
>
>                 Key: COUCHDB-1449
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1449
>             Project: CouchDB
>          Issue Type: Bug
>    Affects Versions: 1.0.3, 1.1.1, 1.2, 1.3
>         Environment: *NIX
>            Reporter: Wendall Cada
>              Labels: patch
>             Fix For: 1.0.4, 1.2.1, 1.1.2
>
>         Attachments: couchdb-0007-wait-for-couch-stop.patch, couchdb-0007-wait-for-couch-stop.patch
>
>
> When restarting couchdb via init script, couchdb returns success status before the process is exited. When a start is issued before the process ends, couchdb fails to start, but returns success.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira