<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 16, 2021 at 9:15 AM Vyacheslav Levytskyy <<a href="mailto:v.levytskyy@yahoo.com">v.levytskyy@yahoo.com</a>> wrote:</div><div dir="ltr" class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
The function doesn't interact with the gen_server that calls spawn/4, <br>
although I'd expect spawn/4 to run a process and return immediately <br>
anyway, am I wrong?<br>
<br></blockquote><div><br></div><div>All spawn operations except for spawn_request() (introduced in OTP 23) are synchronous and block until the new process has been created and the caller of the BIF has received the process identifier of the newly created process or an error is detected. In case the connection between the nodes stalls the caller will be blocked until the network ticker takes down the connection (default 60 seconds).<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>><br>
>> I'm surprised to see my gen_server process hanging forever when<br>
>> executing spawn/4 call. Process info shows spawn_opt/5 as a current<br>
>> function and status is waiting:<br>
>><br>
>> > process_info(P).<br>
>> [{current_function,{erlang,spawn_opt,5}},<br>
>> {status,waiting},<br>
>> {message_queue_len,13},<br>
>> {trap_exit,false},<br>
>> {priority,normal},<br>
>> ...]<br>
>><br></blockquote><div><br></div><div>Would have been interessting to know what process_info(P, messages) had returned. In the distributed case spawn_opt() is waiting for a message on the format: {spawn_reply, Ref, ok|error, Pid|Error}</div></div><div class="gmail_quote"><br></div><div class="gmail_quote">What type of node is the node that you are trying to spawn the new process on? Ordinary Erlang node, C-node, ...? OTP release of that node?<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Regards,</div><div class="gmail_quote">Rickard<br></div>-- <br><div dir="ltr" class="gmail_signature">Rickard Green, Erlang/OTP, Ericsson AB</div></div>