[erlang-bugs] gen_server and {spawn_opt, [monitor]}

Fredrik Linder fredrikelinder@REDACTED
Thu Nov 23 23:47:29 CET 2006


Hi Erlangers

I found a bug in proc_lib, on windows (C:\Program Files\erl5.5.2\lib\stdlib-
1.14.2\src\proc_lib.erl).

If one call gen_server:start(Module, start, Args, [{spawn_opt, [monitor]}])
the call will not return !

Some analysis yields that the cause is that the gen_server:start() call ends
up in erlang:spawn_opt(..., [monitor]) which return {Pid, Monitor}, making
the proc_lib:sync_wait() wait for {Pid, Monitor} and not Pid which is what
the newly spawned process sends in the ack-message.

My guess of a fix is that proc_lib:spawn_opt() checks the return value from
erlang:spawn_opt(). I'm including an untested fix.

Cheers
/Fredrik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20061123/f86c5961/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proc_lib.erl
Type: application/octet-stream
Size: 13251 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20061123/f86c5961/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: org_proc_lib.erl
Type: application/octet-stream
Size: 12900 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20061123/f86c5961/attachment-0001.obj>


More information about the erlang-bugs mailing list