Re: process waits forever spawn_opt/5
Luke Bakken <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CADFEJucn5d_1NjndQyc_62pgzgkKMUA7p8OE7Az==qNHNtpY7Q@mail.gmail.com> |
Hi Vyacheslav, It would be very helpful to share the code that spawn_opt is calling, or provide code to reproduce this condition. Does the function called by spawn_opt interact in _any_ way with the gen_server that calls spawn_opt? Thanks, Luke On Tue, Jun 15, 2021 at 1:09 PM Vyacheslav Levytskyy <[email protected]> wrote: > > 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 >