chef-boneyard / opscode-pushy-server

Chef Push Jobs Server
https://docs.chef.io/push_jobs.html
Apache License 2.0
16 stars 10 forks source link

Duplicate node names in submitted jobs cause server to fail with 500 #108

Open markan opened 9 years ago

markan commented 9 years ago

If a job is started with the same node on the list twice we return 500, and leave a nasty stack trace 2015-03-31_00:18:40.31474 00:18:40.309 error <0.26923.23> CRASH REPORT Process <0.26923.23> with 0 neighbours exited with reason: no case clause matching {conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>} in pushy_sql:insert_job_nodes/1 line 181 in gen_fsm:init_it/6 line 379 2015-03-31_00:18:40.31849 00:18:40.309 error <0.263.0> Supervisor pushy_job_state_sup had child pushy_job_state started with {pushy_job_state,start_link,undefined} at <0.26923.23> exit with reason no case clause matching {conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>} in pushy_sql:insert_job_nodes/1 line 181 in context child_terminated 2015-03-31_00:18:40.32535 00:18:40.310 error <0.23507.23> Webmachine error at path "/organizations/ponyville/pushy/jobs" : {error,{throw,{error,{{case_clause,{conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>}},[{pushy_sql,insert_job_nodes,1,[{file,"src/pushy_sql.erl"},{line,181}]},{pushy_sql,create_job,1,[{file,"src/pushy_sql.erl"},{line,102}]},{pushy_job_state,init,1,[{file,"src/pushy_job_state.erl"},{line,85}]},{gen_fsm,init_it,6,[{file,"gen_fsm.erl"},{line,361}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}},[{pushy_job_state_sup,start,...},...]}} 2015-03-31_00:18:40.32550 00:18:40.313 info <0.264.0> Tried to send node {<<"8b6d93bc489e29a46241cfc34d9985bb">>, <<"available">>}, into rehab but it wasn't there 2015-03-31_00:18:54.82332 00:18:54.817 error <0.26982.23> CRASH REPORT Process <0.26982.23> with 0 neighbours exited with reason: no case clause matching {conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>} in pushy_sql:insert_job_nodes/1 line 181 in gen_fsm:init_it/6 line 379 2015-03-31_00:18:54.82991 00:18:54.817 error <0.263.0> Supervisor pushy_job_state_sup had child pushy_job_state started with {pushy_job_state,start_link,undefined} at <0.26982.23> exit with reason no case clause matching {conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>} in pushy_sql:insert_job_nodes/1 line 181 in context child_terminated 2015-03-31_00:18:54.83395 00:18:54.818 error <0.24664.23> Webmachine error at path "/organizations/ponyville/pushy/jobs" : {error,{throw,{error,{{case_clause,{conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>}},[{pushy_sql,insert_job_nodes,1,[{file,"src/pushy_sql.erl"},{line,181}]},{pushy_sql,create_job,1,[{file,"src/pushy_sql.erl"},{line,102}]},{pushy_job_state,init,1,[{file,"src/pushy_job_state.erl"},{line,85}]},{gen_fsm,init_it,6,[{file,"gen_fsm.erl"},{line,361}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}},[{pushy_job_state_sup,start,...},...]}} 2015-03-31_00:18:54.83401 00:18:54.822 info <0.264.0> Tried to send node {<<"8b6d93bc489e29a46241cfc34d9985bb">>, <<"available">>}, into rehab but it wasn't there 2015-03-31_00:20:51.05716 00:20:51.051 error <0.27405.23> CRASH REPORT Process <0.27405.23> with 0 neighbours exited with reason: no case clause matching {conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>} in pushy_sql:insert_job_nodes/1 line 181 in gen_fsm:init_it/6 line 379 2015-03-31_00:20:51.06139 00:20:51.051 error <0.25259.23> Webmachine error at path "/organizations/ponyville/pushy/jobs" : {error,{throw,{error,{{case_clause,{conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>}},[{pushy_sql,insert_job_nodes,1,[{file,"src/pushy_sql.erl"},{line,181}]},{pushy_sql,create_job,1,[{file,"src/pushy_sql.erl"},{line,102}]},{pushy_job_state,init,1,[{file,"src/pushy_job_state.erl"},{line,85}]},{gen_fsm,init_it,6,[{file,"gen_fsm.erl"},{line,361}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}]}},[{pushy_job_state_sup,start,...},...]}} 2015-03-31_00:20:51.06539 00:20:51.051 error <0.263.0> Supervisor pushy_job_state_sup had child pushy_job_state started with {pushy_job_state,start_link,undefined} at <0.27405.23> exit with reason no case clause matching {conflict,<<"duplicate key value violates unique constraint \"job_nodes_job_id_org_id_node_name_key\"">>} in pushy_sql:insert_job_nodes/1 line 181 in context child_terminated 2015-03-31_00:20:51.06547 00:20:51.055 info <0.264.0> Tried to send node {<<"8b6d93bc489e29a46241cfc34d9985bb">>, <<"available">>}, into rehab but it wasn't there