You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "J. Lee Coltrane (Created) (JIRA)" <ji...@apache.org> on 2011/10/18 01:03:10 UTC

[jira] [Created] (COUCHDB-1310) '/_restart' closes request socket before sending a response

'/_restart' closes request socket before sending a response
-----------------------------------------------------------

                 Key: COUCHDB-1310
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1310
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
    Affects Versions: 1.1
         Environment: All platforms.  Tested on Ubuntu 10.10.
            Reporter: J. Lee Coltrane
            Priority: Minor
             Fix For: 1.1


In 'couchdb_misc_handlers.erl', `handle_restart_req(...)` calls `couch_server_sup:restart_core_server()` before sending the HTTP response.  This causes the current request's socket to be closed without sending any response back to the client.  From the perspective of the HTTP client, the connection is simply dropped - no response is ever received.  

In addition to the obvious aesthetic problems here, the HTTP1.1 spec suggests a specific (and non-desirable) client-side behavior for connections that drop like this. From RFC-2616 Section-8.2.4: "...if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request..." (http://tools.ietf.org/html/rfc2616#section-8.2.4).  Any HTTP client that actually obeys this direction, would end up restarting the server multiple times.

I have a patch that fixes this issue. I will attach it to this report.

This issue may be related to COUCHDB-946 (https://issues.apache.org/jira/browse/COUCHDB-946).

--
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-1310) '/_restart' closes request socket before sending a response

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

Paul Joseph Davis commented on COUCHDB-1310:
--------------------------------------------

quite possible that it makes the hangs better. The test that we currently have for detecting when the server came back is less than robust. I've tried to fix it a couple times but never managed to find something that was significantly less hacky.
                
> '/_restart' closes request socket before sending a response
> -----------------------------------------------------------
>
>                 Key: COUCHDB-1310
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1310
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.1
>         Environment: All platforms.  Tested on Ubuntu 10.10.
>            Reporter: J. Lee Coltrane
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: 0001-fixed-_restart-closes-socket-before-sending-request.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> In 'couchdb_misc_handlers.erl', `handle_restart_req(...)` calls `couch_server_sup:restart_core_server()` before sending the HTTP response.  This causes the current request's socket to be closed without sending any response back to the client.  From the perspective of the HTTP client, the connection is simply dropped - no response is ever received.  
> In addition to the obvious aesthetic problems here, the HTTP1.1 spec suggests a specific (and non-desirable) client-side behavior for connections that drop like this. From RFC-2616 Section-8.2.4: "...if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request..." (http://tools.ietf.org/html/rfc2616#section-8.2.4).  Any HTTP client that actually obeys this direction, would end up restarting the server multiple times.
> I have a patch that fixes this issue. I will attach it to this report.
> This issue may be related to COUCHDB-946 (https://issues.apache.org/jira/browse/COUCHDB-946).

--
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-1310) '/_restart' closes request socket before sending a response

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

Jan Lehnardt commented on COUCHDB-1310:
---------------------------------------

I don't think the test suite is supposed to support a proxy setup.

We added "verify installation" to Futon to cover the basics without running the full test suite for situations like yours.
                
> '/_restart' closes request socket before sending a response
> -----------------------------------------------------------
>
>                 Key: COUCHDB-1310
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1310
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.1
>         Environment: All platforms.  Tested on Ubuntu 10.10.
>            Reporter: J. Lee Coltrane
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: 0001-fixed-_restart-closes-socket-before-sending-request.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> In 'couchdb_misc_handlers.erl', `handle_restart_req(...)` calls `couch_server_sup:restart_core_server()` before sending the HTTP response.  This causes the current request's socket to be closed without sending any response back to the client.  From the perspective of the HTTP client, the connection is simply dropped - no response is ever received.  
> In addition to the obvious aesthetic problems here, the HTTP1.1 spec suggests a specific (and non-desirable) client-side behavior for connections that drop like this. From RFC-2616 Section-8.2.4: "...if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request..." (http://tools.ietf.org/html/rfc2616#section-8.2.4).  Any HTTP client that actually obeys this direction, would end up restarting the server multiple times.
> I have a patch that fixes this issue. I will attach it to this report.
> This issue may be related to COUCHDB-946 (https://issues.apache.org/jira/browse/COUCHDB-946).

--
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-1310) '/_restart' closes request socket before sending a response

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

Paul Joseph Davis commented on COUCHDB-1310:
--------------------------------------------

I'd point out that _restart is really only meant for test code to get the server into a known state. This patch merely hides the issue and doesn't really address the underlying problem, namely, that init:restart is a hard core reset of the VM. If there are concurrent clients accessing the server they will be just as exposed to the original problem. About the only thing to do would be to figure out how to gracefully quit mochiweb before calling init:restart. Its not out of the question, but we moved to this approach when the graceful one didn't work as reliably.
                
> '/_restart' closes request socket before sending a response
> -----------------------------------------------------------
>
>                 Key: COUCHDB-1310
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1310
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.1
>         Environment: All platforms.  Tested on Ubuntu 10.10.
>            Reporter: J. Lee Coltrane
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: 0001-fixed-_restart-closes-socket-before-sending-request.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> In 'couchdb_misc_handlers.erl', `handle_restart_req(...)` calls `couch_server_sup:restart_core_server()` before sending the HTTP response.  This causes the current request's socket to be closed without sending any response back to the client.  From the perspective of the HTTP client, the connection is simply dropped - no response is ever received.  
> In addition to the obvious aesthetic problems here, the HTTP1.1 spec suggests a specific (and non-desirable) client-side behavior for connections that drop like this. From RFC-2616 Section-8.2.4: "...if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request..." (http://tools.ietf.org/html/rfc2616#section-8.2.4).  Any HTTP client that actually obeys this direction, would end up restarting the server multiple times.
> I have a patch that fixes this issue. I will attach it to this report.
> This issue may be related to COUCHDB-946 (https://issues.apache.org/jira/browse/COUCHDB-946).

--
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-1310) '/_restart' closes request socket before sending a response

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

J. Lee Coltrane updated COUCHDB-1310:
-------------------------------------

    Attachment: 0001-fixed-_restart-closes-socket-before-sending-request.patch

here is a patch that fixes this issue (COUCHDB-1310)
                
> '/_restart' closes request socket before sending a response
> -----------------------------------------------------------
>
>                 Key: COUCHDB-1310
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1310
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.1
>         Environment: All platforms.  Tested on Ubuntu 10.10.
>            Reporter: J. Lee Coltrane
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: 0001-fixed-_restart-closes-socket-before-sending-request.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> In 'couchdb_misc_handlers.erl', `handle_restart_req(...)` calls `couch_server_sup:restart_core_server()` before sending the HTTP response.  This causes the current request's socket to be closed without sending any response back to the client.  From the perspective of the HTTP client, the connection is simply dropped - no response is ever received.  
> In addition to the obvious aesthetic problems here, the HTTP1.1 spec suggests a specific (and non-desirable) client-side behavior for connections that drop like this. From RFC-2616 Section-8.2.4: "...if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request..." (http://tools.ietf.org/html/rfc2616#section-8.2.4).  Any HTTP client that actually obeys this direction, would end up restarting the server multiple times.
> I have a patch that fixes this issue. I will attach it to this report.
> This issue may be related to COUCHDB-946 (https://issues.apache.org/jira/browse/COUCHDB-946).

--
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-1310) '/_restart' closes request socket before sending a response

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

J. Lee Coltrane commented on COUCHDB-1310:
------------------------------------------

I agree: If '/_restart' were to become a truly "useful" part of the api, it would need to do a graceful shutdown.  This might be a useful feature to add, but it's certainly not provided by the attached patch.

However, as it stands today, the tests *do* depend on the '/_restart' interface, and the issue reported here appears to be the cause of a lot of the flakey test-suite behavior that I (and others) have observed in 1.1.0.  This is especially true when accessing couchdb through a proxy, as the proxy's handling of the dropped connection varies depending on the proxy implementation.  Unfortunately, this is also one of the cases where the test suite would be most useful -- verifying the correctness of a custom reverse-proxy implementation for use in-front-of couchdb.

There are various notes in the dev-list archives about the tests hanging (and other flakey behavior).
With this patch in place, I'm no longer seeing tests hang like that.  (I'm still seeing some scattered issues from the test suite -- but no hanging)

                
> '/_restart' closes request socket before sending a response
> -----------------------------------------------------------
>
>                 Key: COUCHDB-1310
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1310
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>    Affects Versions: 1.1
>         Environment: All platforms.  Tested on Ubuntu 10.10.
>            Reporter: J. Lee Coltrane
>            Priority: Minor
>             Fix For: 1.1
>
>         Attachments: 0001-fixed-_restart-closes-socket-before-sending-request.patch
>
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> In 'couchdb_misc_handlers.erl', `handle_restart_req(...)` calls `couch_server_sup:restart_core_server()` before sending the HTTP response.  This causes the current request's socket to be closed without sending any response back to the client.  From the perspective of the HTTP client, the connection is simply dropped - no response is ever received.  
> In addition to the obvious aesthetic problems here, the HTTP1.1 spec suggests a specific (and non-desirable) client-side behavior for connections that drop like this. From RFC-2616 Section-8.2.4: "...if the client sees the connection close before receiving any status from the server, the client SHOULD retry the request..." (http://tools.ietf.org/html/rfc2616#section-8.2.4).  Any HTTP client that actually obeys this direction, would end up restarting the server multiple times.
> I have a patch that fixes this issue. I will attach it to this report.
> This issue may be related to COUCHDB-946 (https://issues.apache.org/jira/browse/COUCHDB-946).

--
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