A developer is reporting that a CouchDB pull replication, with source the Couchbase Sync Gateway, is failing with Erlang exceptions. The cause appears to be a MIME multipart response from a GET of a document with attachments — he says “the response of SG GET /nam/image-97m333b8iah?revs=true&open_revs=%5B%229-9f060576f801f3c9cea5c90013c6d182%22%5D&latest=true properly returns a multipart document, but it seems CouchDB 1.5 is unable to parse the data.”
I don’t think this is the known-and-recently-fixed issue with CouchDB and chunked encoding. Replicating attachments to CouchDB has been working for a while, and the developer reports "the documents only containing 2 images did replicate from SG to CouchDB 1.5.” It may be that the exact length or contents of this document are triggering some kind of edge case in CouchDB. Anyway, I can’t make head or tail of the Erlang crash logs; could someone skilled in the art provide some insight into what happened to CouchDB? Thanks! —Jens > Using CouchDB 1.3 the pull replication fails completely. Erlang throws some > errors and completely restarts. > > Using CouchDB 1.5 the pull replication does not fail, but is never completed. > It seems CouchDB is unable to parse the multipart response. > CouchDB 1.5 logs: > > [Tue, 22 Apr 2014 13:40:42 GMT] [error] [<0.17159.1>] Replication crashing > because GET > http://192.168.1.2:4985/nam/image-97m333b8iah?revs=true&open_revs=%5B%229-9f060576f801f3c9cea5c90013c6d182%22%5D&latest=true > failed > [Tue, 22 Apr 2014 13:40:42 GMT] [error] [<0.17142.1>] ** Generic server > <0.17142.1> terminating > ** Last message in was {'EXIT',<0.17159.1>,kaboom} > ** When Server state == {state,<0.17123.1>,<0.17143.1>,20, > {httpdb,"http://192.168.1.2:4985/nam/",nil, > [{"Accept","application/json"}, > {"User-Agent","CouchDB/1.5.0"}], > 30000, > [{socket_options, > [{keepalive,true},{nodelay,false}]}], > 10,250,<0.17124.1>,20}, > {db,<0.17131.1>,<0.17132.1>,nil, > <<"1398170695581111">>,<0.17133.1>, > <0.17129.1>,<0.17135.1>, > {db_header,6,9,0, > {2230287,{3,6,2227482},1191}, > {2228708,9,508}, > {2232424,[],807}, > 0,nil,nil,1000}, > 9, > {btree,<0.17129.1>, > {2230287,{3,6,2227482},1191}, > #Fun<couch_db_updater.10.75275056>, > #Fun<couch_db_updater.11.75275056>, > #Fun<couch_btree.5.71351651>, > > #Fun<couch_db_updater.12.75275056>,snappy}, > {btree,<0.17129.1>, > {2228708,9,508}, > #Fun<couch_db_updater.13.75275056>, > #Fun<couch_db_updater.14.75275056>, > #Fun<couch_btree.5.71351651>, > > #Fun<couch_db_updater.15.75275056>,snappy}, > {btree,<0.17129.1>, > {2232424,[],807}, > #Fun<couch_btree.3.71351651>, > #Fun<couch_btree.4.71351651>, > #Fun<couch_btree.5.71351651>,nil,snappy}, > 9,<<"snagtracker-140417-tenpost">>, > > "/usr/local/var/lib/couchdb/snagtracker-140417-tenpost.couch", > [],[],nil, > {user_ctx,null,[],undefined}, > nil,1000, > [before_header,after_header,on_file_open], > [{user_ctx,{user_ctx,null,[],undefined}}], > snappy,nil,nil}, > [<0.17159.1>], > nil,nil, > {<0.17143.1>,#Ref<0.0.2.127076>}, > {rep_stats,1,1,0,0,0}, > nil,<0.17144.1>, > {batch,[],0}} > ** Reason for termination == > ** {process_died,<0.17159.1>,kaboom} > > [Tue, 22 Apr 2014 13:40:42 GMT] [error] [<0.17142.1>] > {error_report,<0.17006.1>, > {<0.17142.1>,crash_report, > [[{initial_call, > {couch_replicator_worker,init,['Argument__1']}}, > {pid,<0.17142.1>}, > {registered_name,[]}, > {error_info, > {exit, > {process_died,<0.17159.1>,kaboom}, > [{gen_server,terminate,6, > [{file,"gen_server.erl"},{line,744}]}, > {proc_lib,init_p_do_apply,3, > [{file,"proc_lib.erl"},{line,239}]}]}}, > {ancestors, > [<0.17123.1>,couch_replicator_job_sup, > couch_primary_services,couch_server_sup, > <0.17007.1>]}, > {messages,[{'EXIT',<0.17144.1>,normal}]}, > {links,[<0.17143.1>,<0.17123.1>]}, > {dictionary, > [{last_stats_report,{1398,170695,606206}}]}, > {trap_exit,true}, > {status,running}, > {heap_size,1598}, > {stack_size,27}, > {reductions,305}], > [{neighbour, > [{pid,<0.17143.1>}, > {registered_name,[]}, > {initial_call,{erlang,apply,2}}, > {current_function,{gen,do_call,4}}, > {ancestors,[]}, > {messages,[]}, > {links,[<0.17142.1>]}, > {dictionary,[]}, > {trap_exit,false}, > {status,waiting}, > {heap_size,1598}, > {stack_size,22}, > {reductions,249}]}]]}}
