I am sending several POST requests to InfluxDB with shotgun
. I reuse an existing connection. After some time the server decides to close the connection although I use a keep-alive in the header.
In my case shutgun
fails because of a missing transistion in gen_statem
from state at_rest
. This state can’t handle a gun_down
event. But I still think the problem is on my side! Please give me hint what I am doing wrong.
Crash Log:
2024-09-27 08:25:22 =ERROR REPORT====
** State machine <0.3080.0> terminating
** Last event = {info,{gun_down,<0.3081.0>,http,closed,[]}}
** When server state = {at_rest,#{async => false,data => <<>>,pid => <0.3081.0>,stream => #Ref<0.3941012180.4012638211.1733>,buffer => <<>>,handle_event => undefined,headers => undefined,from => {<0.3020.0>,#Ref<0.3941012180.4012638209.195735>},status_code => undefined,async_mode => binary,responses => {[],[]},pending_requests => {[],[]}}}
** Reason for termination = error:function_clause
** Callback modules = [shotgun]
** Callback mode = state_functions
** Stacktrace =
** [{shotgun,at_rest,[cast,{gun_down,<0.3081.0>,http,closed,[]},#{async => false,data => <<>>,pid => <0.3081.0>,stream => #Ref<0.3941012180.4012638211.1733>,buffer => <<>>,handle_event => undefined,headers => undefined,from => {<0.3020.0>,#Ref<0.3941012180.4012638209.195735>},status_code => undefined,async_mode => binary,responses => {[],[]},pending_requests => {[],[]}}],[{file,"/home/fk/repos/png/alm_tooling/alm-metrics/_build/default/lib/shotgun/src/shotgun.erl"},{line,438}]},{gen_statem,loop_state_callback,11,[{file,"gen_statem.erl"},{line,3113}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,329}]}]
2024-09-27 08:25:22 =CRASH REPORT====
crasher:
initial call: shotgun:init/1
pid: <0.3080.0>
registered_name: []
process_label: undefined
exception error: {function_clause,[{shotgun,at_rest,[cast,{gun_down,<0.3081.0>,http,closed,[]},#{async => false,data => <<>>,pid => <0.3081.0>,stream => #Ref<0.3941012180.4012638211.1733>,buffer => <<>>,handle_event => undefined,headers => undefined,from => {<0.3020.0>,#Ref<0.3941012180.4012638209.195735>},status_code => undefined,async_mode => binary,responses => {[],[]},pending_requests => {[],[]}}],[{file,"/home/fk/repos/png/alm_tooling/alm-metrics/_build/default/lib/shotgun/src/shotgun.erl"},{line,438}]},{gen_statem,loop_state_callback,11,[{file,"gen_statem.erl"},{line,3113}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,329}]}]}
ancestors: [shotgun_sup,<0.968.0>]
message_queue_len: 0
messages: []
links: [<0.969.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 1598
stack_size: 29
reductions: 911
neighbours:
2024-09-27 08:25:22 =SUPERVISOR REPORT====
Supervisor: {local,shotgun_sup}
Context: child_terminated
Reason: {function_clause,[{shotgun,at_rest,[cast,{gun_down,<0.3081.0>,http,closed,[]},#{async => false,data => <<>>,pid => <0.3081.0>,stream => #Ref<0.3941012180.4012638211.1733>,buffer => <<>>,handle_event => undefined,headers => undefined,from=> {<0.3020.0>,#Ref<0.3941012180.4012638209.195735>},status_code => undefined,async_mode => binary,responses => {[],[]},pending_requests => {[],[]}}],[{file,"/home/fk/repos/png/alm_tooling/alm-metrics/_build/default/lib/shotgun/src/shotgun.erl"},{line,438}]},{gen_statem,loop_state_callback,11,[{file,"gen_statem.erl"},{line,3113}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,329}]}]}
Offender: [{pid,<0.3080.0>},{id,shotgun},{mfargs,{shotgun,start_link,undefined}},{restart_type,temporary},{significant,false},{shutdown,5000},{child_type,worker}]