Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1375

couch_query_servers pool deadlock when running "os_process_limit" indexers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.1
    • None
    • View Server Support
    • None

    Description

      When using external view servers, such as couchjs for example, if we trigger "os_process_limit" (or more) index updates simultaneously, we can reach a deadlock case.

      The issue is that each index updater will acquire a couchjs (os_proc record) process from couch_query_servers to apply the map function against each document. After the indexer finishes, it will release (return to couch_query_servers) the couchjs process used for the maps.

      However, while the indexer is writing to the btrees, if the reduce function is a JavaScript function (or any other language other than Erlang or a builtin reduce function), the function is called often to reduce key-values - this results in the view updater process to ask couch_query_servers for a another couchjs process (this is done on every reduce function call) - however "os_process_limit" couchjs processes are already allocated to "os_process_limit" indexers for the mapping.

      The solution here would be to have the index updater to preallocate a couchjs process for the reduces and release it when it finishes (like it's done for the maps).

      This only happens if the number of changes to index is greater than 500 (the work queue sizes).

      Attachments

        Activity

          People

            Unassigned Unassigned
            fdmanana Filipe David Borba Manana
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: