uwiger / gproc

Extended process registry for Erlang
Apache License 2.0
1.07k stars 232 forks source link

Catch error from gproc:reset_counter/1 #165

Closed leoliu closed 4 years ago

leoliu commented 5 years ago

in gproc_pool:execute_claim/3. During the course of execute_claim/3 if Pid dies gproc:reset_counter/1 may crash

** exception error: no match of right hand side value [] in function gproc:reset_counter1/1 (gproc.erl, line 1895) in call from gproc:reset_counter/1 (gproc.erl, line 1889) in call from gproc_pool:execute_claim/3 (gproc_pool.erl, line 548) in call from gproc_pool:try_claim/2 (gproc_pool.erl, line 501) in call from gprocpool:claim/2 (gproc_pool.erl, line 473) in call from gproc_pool:claim_w/3 (gproc_pool.erl, line 452) ....

which completely obscures the real crash. With this change you instead get:

** exception exit: {{shutdown,timeout}, {gen_statem,call, [<0.14440.1>, {query,[<<81,0,0,0,25>>,["SELECT pg_sleep(60);",0]],5000}, infinity]}} in function gen:do_call/4 (gen.erl, line 177) in call from gen_statem:call_dirty/4 (gen_statem.erl, line 598) in call from gproc_pool:execute_claim/3 (gproc_pool.erl, line 549) ....

uwiger commented 4 years ago

Great! Merged, and thanks.