couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Goacher (JIRA)" <j...@apache.org>
Subject [jira] [Created] (COUCHDB-1525) Error reading document after multipart put
Date Mon, 20 Aug 2012 09:47:37 GMT
Julian Goacher created COUCHDB-1525:
---------------------------------------

             Summary: Error reading document after multipart put
                 Key: COUCHDB-1525
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1525
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
    Affects Versions: 1.2
         Environment: Mac OS 10.6.8
            Reporter: Julian Goacher
            Priority: Blocker
             Fix For: 1.3


GETing a document after a multipart PUT which uploaded an attachment generates a 500 error.
To reproduce:

Following document is in a DB (called semo_test here).

   {
       "_id": "doc0",
       "_rev": "1-7e97409c987eac3a99385a17ad4cbabe",
       "value": 0
   }

Update the document and add an attachment using a multipart/related request:

   PUT /semo_test/doc0 HTTP/1.1
   Accept: application/json, */*
   content-type:
   multipart/related;boundary=multipart_related_boundary~~~~~~~~~~~~~~~~~~~~
   Host: localhost:5984
   Content-Length: 435
   Connection: keep-alive

   --multipart_related_boundary~~~~~~~~~~~~~~~~~~~~
   Content-Type: application/json

   {"value":0,"_id":"doc0","_rev":"1-7e97409c987eac3a99385a17ad4cbabe","_attachments":{"plus
   1":{"stub":false,"follows":true,"content_type":"application/json","length":14}},".cache":{"plus
   1":{"timestamp":"2012-08-13T13:59:27.826Z"}}}
   --multipart_related_boundary~~~~~~~~~~~~~~~~~~~~

   {"value":"01"}
   --multipart_related_boundary~~~~~~~~~~~~~~~~~~~~--
   HTTP/1.1 201 Created
   Server: CouchDB/1.2.0 (Erlang OTP/R15B)
   Location: http://127.0.0.1:2222/semo_test/doc0
   ETag: "2-37f62cdf8cb68339a30b7b20d7eb0d1d"
   Date: Mon, 13 Aug 2012 14:00:49 GMT
   Content-Type: application/json
   Content-Length: 67
   Cache-Control: must-revalidate

   {"ok":true,"id":"doc0","rev":"2-37f62cdf8cb68339a30b7b20d7eb0d1d"}

Request the updated document:

   GET /semo_test/doc0 HTTP/1.1
   Accept: application/json, */*
   Host: localhost:5984

   HTTP/1.1 500 Internal Server Error
   Server: CouchDB/1.2.0 (Erlang OTP/R15B)
   Date: Mon, 13 Aug 2012 14:10:02 GMT
   Content-Type: application/json
   Content-Length: 43
   Cache-Control: must-revalidate

   {"error":"unknown_error","reason":"undef"}

Following stacktrace is generated when handling the GET:

   [Mon, 13 Aug 2012 14:10:02 GMT] [error] [<0.6811.10>] Uncaught error
   in HTTP request: {error,undef}
   [Mon, 13 Aug 2012 14:10:02 GMT] [info] [<0.6811.10>] Stacktrace:
   [{base64,encode,
   [<<115,176,77,34,80,64,240,8,14,182,224,
   181,170,42,191,128>>],
                                          []},
   {couch_doc,'-to_json_attachments/4-fun-0-',
                                          4,
   [{file,"couch_doc.erl"},{line,110}]},
                                      {lists,map,2,
   [{file,"lists.erl"},{line,1173}]},
   {couch_doc,to_json_attachments,4,
   [{file,"couch_doc.erl"},{line,101}]},
   {couch_doc,doc_to_json_obj,2,
   [{file,"couch_doc.erl"},{line,153}]},
   {couch_httpd_db,send_doc_efficiently,4,
   [{file,"couch_httpd_db.erl"},
                                           {line,836}]},
                                      {couch_httpd_db,do_db_req,2,
   [{file,"couch_httpd_db.erl"},
                                           {line,230}]},
   {couch_httpd,handle_request_int,5,
   [{file,"couch_httpd.erl"},{line,317}]}]
   [Mon, 13 Aug 2012 14:10:02 GMT] [error] [<0.6811.10>] Uncaught
   server error: undef
   [Mon, 13 Aug 2012 14:10:02 GMT] [info] [<0.6811.10>] 127.0.0.1 - -
   GET /test/doc0 500

(This problem was originally reported on user@couchdb and Robert Newson requested that I raise
it here. Note that these steps generate the error as described when I test on one couchdb
installation, but when I try the same steps on a separate installation - also Mac OS 10 -
the 500 error doesn't occur, so possibly the error is somehow related to db state).

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

        

Mime
View raw message