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

function_clause error when querying views with cors

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • HTTP Interface
    • None

    Description

      When querying views using the new cross-origin support, CouchDB sometimes raises a function_clause error instead of returning the results. It doesn’t do so consistently. For example, if the other-origin webpage makes two requests after each other, one may work and the other may fail (in any order). I haven’t seen this error yet when querying views without using cors. Rebuilding CouchDB, remaking the databases or refreshing the views doesn’t work and the view itself doesn’t do much that can go wrong:

      The view
      profiles: {
        map: function(doc) {
          if (doc.type && doc.type == 'profile') emit(doc.user, null);
        }
      }
      

      I’m running CouchDB 1.3 commit 8be3ec0218873fa3516f564678dbd2c74ebb5246 with build-couchdb commit fabf7c51c8c5b278b72ffe95f12915016f104996.

      The stacktrace
      [error] [<0.653.0>] function_clause error in HTTP request
      [info] [<0.653.0>] Stacktrace: [{string,to_lower,                                                                                                                                 
                                       [undefined],
                                       [{file,"string.erl"},{line,468}]},                                                                                                               
                                      {couch_httpd_cors,maybe_apply_cors_headers,2,
                                       [{file,                                                                                                                                          
                                         "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd_cors.erl"},
                                        {line,219}]},                                                                                                                                   
                                      {couch_httpd,send_response,4,
                                       [{file,                                                                                                                                          
                                         "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd.erl"},
                                        {line,704}]},                                                                                                                                   
                                      {couch_mrview_http,design_doc_view,5,
                                       [{file,                                                                                                                                          
                                         "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couch_mrview/src/couch_mrview_http.erl"},
                                        {line,147}]},                                                                                                                                   
                                      {couch_httpd_db,do_db_req,2,
                                       [{file,                                                                                                                                          
                                         "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd_db.erl"},
                                        {line,234}]},                                                                                                                                   
                                      {couch_httpd,handle_request_int,5,
                                       [{file,                                                                                                                                          
                                         "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/couchdb/couch_httpd.erl"},
                                        {line,329}]},                                                                                                                                   
                                      {mochiweb_http,headers,5,
                                       [{file,                                                                                                                                          
                                         "/home/sander/git/build-couchdb1.3/dependencies/couchdb/src/mochiweb/mochiweb_http.erl"},
                                        {line,136}]},                                                                                                                                   
                                      {proc_lib,init_p_do_apply,3,
                                       [{file,"proc_lib.erl"},{line,227}]}]                                                                                                             
      [info] [<0.653.0>] 83.255.2.0 - - GET /lunacy%2Fuser%2Fsander/_design/user/_view/profiles?include_docs=true&key=%22Bot%203%22&reduce=false 500
      [error] [<0.653.0>] httpd 500 error response:                                                                                                                                     
       {"error":"unknown_error","reason":"function_clause"}
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sanderd Sander Dijkhuis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: