[erlang-questions] Using 'monitor' with spawn_opt/3 throws badarg. Documentation bug?

Robert Virding rvirding@REDACTED
Tue Feb 24 00:54:25 CET 2015


Which versions of erlang are you running on the nodes?


On 24 February 2015 at 00:53, Robert Virding <rvirding@REDACTED> wrote:

> The implication is that as it does not work with spawn_opt/5 which spawns
> a process on another node then it will also not work for spawn_opt/3 which
> does the same thing. Whether you give a fun or Mod,Fun,Args is irrelevant
> here.
>
> Another reason for getting the badarg is the fun. To pass and call funs on
> other nodes requires exactly the same version of the module in which the
> fun is defined, in this case erl_eval. An easy way to test this is to just
> try and spawn the fun on the other node with spawn/2. If that works then
> this is not the problem.
>
> Robert
>
>
> On 23 February 2015 at 21:13, Rick Pettit <rpettit@REDACTED> wrote:
>
>> I might have guessed the same, as I do not use spawn_opt/x much — but
>> looking at the documentation for spawn_opt/3, that third argument is the
>> set of *options* for the spawn opt, and *not* the set of arguments to pass
>> to the fun.
>>
>> -Rick
>>
>> > On Feb 23, 2015, at 2:07 PM, e@REDACTED wrote:
>> >
>> > the 0-ary function
>> > does not unify with a pair of arguments provided.
>> > i suspect this is the issue.
>> >
>> >
>> > On 02/23/2015 04:17 PM, Roger Lipscombe wrote:
>> >> I'm attempting to use spawn_opt/3 with a remote node, like this:
>> >>
>> >>     Fun = fun() -> ok end,
>> >>     {Pid, Ref} = spawn_opt(Node, Fun, [link, monitor]).
>> >>
>> >> It fails with:
>> >>
>> >>     {badarg,
>> >>       [{erlang,spawn_opt,
>> >>        ['imp_server@REDACTED',erlang,apply,
>> >>         [#Fun<erl_eval.20.80484245>,[]],
>> >>         [link,monitor]],
>> >>        []}
>> >>
>> >> Now, the documentation at
>> >> http://www.erlang.org/doc/man/erlang.html#spawn_opt-5 says that the
>> >> 'monitor' option is not allowed for spawn_opt/5. It says nothing about
>> >> spawn_opt/3.
>> >>
>> >> Looking at the error message, it looks like spawn_opt/3 simply calls
>> >> spawn_opt/5. Does this note about 'monitor' being unsupported need to
>> >> be in documentation for both functions?
>> >> _______________________________________________
>> >> erlang-questions mailing list
>> >> erlang-questions@REDACTED
>> >> http://erlang.org/mailman/listinfo/erlang-questions
>> >>
>> > _______________________________________________
>> > erlang-questions mailing list
>> > erlang-questions@REDACTED
>> > http://erlang.org/mailman/listinfo/erlang-questions
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150224/549908c5/attachment.htm>


More information about the erlang-questions mailing list