process waits forever spawn_opt/5

Vyacheslav Levytskyy v.levytskyy@REDACTED
Tue Jun 15 22:06:57 CEST 2021


Hello,

I'm surprised to see my gen_server process hanging forever when 
executing spawn/4 call. Process info shows spawn_opt/5 as a current 
function and status is waiting:

 > process_info(P).
[{current_function,{erlang,spawn_opt,5}},
  {status,waiting},
  {message_queue_len,13},
  {trap_exit,false},
  {priority,normal},
  ...]

Current stacktrace looks like:

 > process_info(P, current_stacktrace).
{current_stacktrace,[{erlang,spawn_opt,5,[]},
                      {erlang,spawn,4,[]},
                      ...
                      {my_gen_server,handle_cast,2,
                                     [{file,"..."},
                                      {line,...}]},
                      {gen_server,try_dispatch,4,
[{file,"gen_server.erl"},{line,695}]},
                      {gen_server,handle_msg,6,
[{file,"gen_server.erl"},{line,771}]},
                      {proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,226}]}]}

I wonder what could be conditions that made spawn_opt/5 to stuck in this 
state. Is there something I can do on my side to prevent such problems 
in future?

It's Erlang/OTP 24.0.2:

Erlang/OTP 24 [erts-12.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] 
[async-threads:1] [jit]

Thank you,
Vyacheslav



More information about the erlang-questions mailing list