couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (COUCHDB-2365) Failing multipart requests leave dangling couch_stream processes
Date Tue, 28 Oct 2014 15:22:34 GMT


ASF GitHub Bot commented on COUCHDB-2365:

GitHub user mikewallace1979 opened a pull request:

    2365 fix failed multipart process leak

    Test is added in a separate commit to make verifying the fix easier - the two commits
will be squashed together before merge.

You can merge this pull request into a Git repository by running:

    $ git pull 2365-fix-failed-multipart-process-leak

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #11
commit 8f9bd3e6c762b58a2d7d3bdc06131a606d904783
Author: Mike Wallace <>
Date:   2014-10-07T22:45:11Z

    [squash] Add a test for COUCHDB-2365

commit fd7f88895240b6fb5f8672ab48d8d18655803ee9
Author: Mike Wallace <>
Date:   2014-10-07T16:09:34Z

    Make couch_stream monitor the stream opener
    This commit fixes a process leak which would happen when a process
    opened a couch_stream and exited with reason normal before closing
    the stream.
    This patch makes the couch_stream gen_server monitor the process
    which opens the stream. When that monitor sends an exit signal
    the couch_stream gen_server is stopped and the process dies.
    Closes COUCHDB-2365


> Failing multipart requests leave dangling couch_stream processes
> ----------------------------------------------------------------
>                 Key: COUCHDB-2365
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: Database Core
>    Affects Versions: 1.5.1, 1.6.0
>            Reporter: Mike Wallace
>            Priority: Minor
>             Fix For: 2.0.0
> Multipart requests spawn a couch_stream gen_server when couch_stream:open/2 is called
in couch_db:with_stream/3 [1]. Currently this gen_server will only be stopped when couch_db:with_stream/3
calls couch_stream:close/1 which happens after the callback Fun is executed [2]. If anything
goes wrong before closing the stream then the couch_stream gen_server will exit as long as
the process that opened the stream exits with a reason other than normal (since the processes
are linked). However, if the process which opened the stream exits with reason normal before
closing the stream then the process will live indefinitely.
> Ordinarily this is not particularly bothersome however if the volume of failing multipart
requests is high the resources consumed by these dangling processes can be significant (consuming
all available memory in the worst case).
> This can be reproduced by making failing multipart requests and observing the number
of processes with initial call couch_stream:init/1 e.g.:
> [1]
> [2]

This message was sent by Atlassian JIRA

View raw message