[ 
https://issues.apache.org/jira/browse/COUCHDB-3184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15592325#comment-15592325
 ] 

ASF subversion and git services commented on COUCHDB-3184:
----------------------------------------------------------

Commit 1d5c6a5d92977308fd94b2b8f43463b9f2bdac71 in couchdb-couch-mrview's 
branch refs/heads/master from [~jaydoane]
[ https://git-wip-us.apache.org/repos/asf?p=couchdb-couch-mrview.git;h=1d5c6a5 ]

Retry failures in couch_mrview_compactor:recompact

Currently, if there's an error in the spawned couch_index_updater:update
process, the receive block will not match the message, and the calling
process will block forever.

This commit changes the receive pattern to match both successful updates
as well as errors, logging the errors, and retrying the recompact a
configurable number of times. If the configured retry count is exceeded,
it logs an error, and returns the original state.

COUCHDB-3184


> couch_mrview_compactor:recompact/1 does not handle errors in spawned process
> ----------------------------------------------------------------------------
>
>                 Key: COUCHDB-3184
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-3184
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>            Reporter: Jay Doane
>
> The recompact function receive block only matches on tuples of the form
> {code}
> {'DOWN', Ref, _, _, {updated, Pid, State2}}
> {code}
> see: 
> https://github.com/apache/couchdb-couch-mrview/blob/master/src/couch_mrview_compactor.erl#L156
> but errors in the spawned process running couch_index_updater:update can 
> return different forms, as shown in these processes captured by a user below. 
> This results in the spawning process blocking forever in the receive.
> {code}
> ([email protected])1> process_info(pid(0,24597,7370)).
> [{current_function,{couch_mrview_compactor,recompact,1}},
> {initial_call,{erlang,apply,2}},
> {status,waiting},
> {message_queue_len,1},
> {messages,[{'DOWN',#Ref<0.0.689040.41604>,process,
>                     <0.9551.7382>,
>                     {timeout,{gen_server,call,
>                                         
> [couch_proc_manager,{get_proc,<<"javascript">>},5000]}}}]},
> {links,[<0.14960.3332>,<0.4951.7370>]},
> {dictionary,[{io_priority,{view_compact,<<"shards/80000000-9fffffff/default/master_party_db_perf.146124"...>>,
>                                         <<"_design/sourcePrimaryKey_V">>}},
>               {task_status_props,[{changes_done,12044429},
>                                   
> {database,<<"shards/80000000-9fffffff/default/master_party_db"...>>},
>                                   
> {design_document,<<"_design/sourcePrimaryKey_V">>},
>                                   {phase,view},
>                                   {progress,79},
>                                   {started_on,1471048118},
>                                   {total_changes,15182867},
>                                   {type,view_compaction},
>                                   {updated_on,1471048883},
>                                   {view,0}]},
>               {task_status_update,{{0,0,0},0}}]},
> {trap_exit,false},
> {error_handler,error_handler},
> {priority,normal},
> {group_leader,<0.237.0>},
> {total_heap_size,954562},
> {heap_size,121536},
> {stack_size,15},
> {reductions,354812127},
> {garbage_collection,[{min_bin_vheap_size,46422},
>                       {min_heap_size,233},
>                       {fullsweep_after,65535},
>                       {minor_gcs,9}]},
> {suspending,[]}]
> ([email protected])1> process_info(pid(0,182,3858)).
> [{current_function,{couch_mrview_compactor,recompact,1}},
> {initial_call,{erlang,apply,2}},
> {status,waiting},
> {message_queue_len,1},
> {messages,[{'DOWN',#Ref<0.0.661774.27928>,process,
>                     <0.17557.3858>,
>                     {{nocatch,{os_process_error,"OS process timed out."}},
>                     [{couch_os_process,prompt,2,
>                                         
> [{file,"src/couch_os_process.erl"},{line,59}]},
>                       {couch_query_servers,map_doc_raw,2,
>                                           
> [{file,"src/couch_query_servers.erl"},{line,84}]},
>                       {couch_mrview_updater,'-map_docs/2-fun-0-',3,
>                                             
> [{file,"src/couch_mrview_updater.erl"},{line,146}]},
>                       {lists,foldl,3,[{file,"lists.erl"},{line,1261}]},
>                       {couch_mrview_updater,map_docs,2,
>                                             
> [{file,"src/couch_mrview_updater.erl"},{line,153}]}]}}]},
> {links,[<0.31690.3859>,<0.32697.3856>]},
> {dictionary,[{io_priority,{view_compact,<<"shards/40000000-5fffffff/default/master_party_db.1463838377">>,
>                                         
> <<"_design/sourcePartyIdentifier_V">>}},
>               {task_status_props,[{changes_done,7905},
>                                   
> {database,<<"shards/40000000-5fffffff/default/master_party_db"...>>},
>                                   
> {design_document,<<"_design/sourcePartyIdentifier_V">>},
>                                   {phase,view},
>                                   {progress,0},
>                                   {started_on,1471298853},
>                                   {total_changes,6261085},
>                                   {type,view_compaction},
>                                   {updated_on,1471298856},
>                                   {view,0}]},
>               {task_status_update,{{0,0,0},0}}]},
> {trap_exit,false},
> {error_handler,error_handler},
> {priority,normal},
> {group_leader,<0.218.0>},
> {total_heap_size,364609},
> {heap_size,46422},
> {stack_size,15},
> {reductions,230416},
> {garbage_collection,[{min_bin_vheap_size,46422},
>                       {min_heap_size,233},
>                       {fullsweep_after,65535},
>                       {minor_gcs,3}]},
> {suspending,[]}]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to