[erlang-questions] jinterface

Serge Aleynikov <>
Sat Oct 4 16:49:27 CEST 2008


Ah, I see, this makes sense.  Meanwhile, I looked through the 
distribution sources, ei, and jinterface and see that it's not that 
difficult to add some monitoring support for non-Erlang nodes so that 
they can monitor Erlang pids.  I'll patch otp.net and later ei if I find 
time this or next weekend.

Serge

Robert Virding wrote:
> It's not the io server which tries to setup a monitor, but the io module
> itself. These are two separate but cooperating entities. The io module
> monitors the io server to make sure that the call will not block if the
> process dies. The easiest way around this is to do the send/receive to the
> io serv yourself without a monitor.
> 
> Robert
> 
> 2008/10/4 Serge Aleynikov <>
> 
>> One other "nasty" feature is that any attempt to make an RPC call of
>> io:format/2 from a Java/.NET node fails with badarg, because io server
>> tries to set up a monitor to the remote pid and fails miserably...
>>
>> Actually I see what's missing in Java/OTP.NET implementation.  These
>> features are documented here:
>> http://www.erlang.org/doc/apps/erts/erl_dist_protocol.html#9.7
>>
>> Serge
>>
>>
>>
>> Paul Guyot wrote:
>>>> Date: Sat, 04 Oct 2008 01:32:55 -0400
>>>> From: Serge Aleynikov <>
>>>> Subject: Re: [erlang-questions] jinterface (was: otp.net)
>>>>
>>>> I tried a similar test using jinterface to see if it's possible to
>>>> monitor processes running on a Java node and ran into the same failure.
>>>>
>>>> Can anyone explain what's wrong?
>>>>
>>>> ()10> {test, } ! {self(), hello}.
>>>> {<0.45.0>,hello}
>>>> ()11> f(), {Pid, _} = receive M -> M end.
>>>> {<5979.1.0>,hello}
>>>> ()12> erlang:monitor(process, Pid).
>>>> ** exception error: bad argument
>>>>       in function  erlang:monitor/2
>>>>          called as erlang:monitor(process,<5979.1.0>)
>>> I've seen a comment in stdlib/gen.erl, at line 196, that suggests that
>>> Java and C nodes are featureweak, and processes in such nodes cannot be
>>> monitored. Instead, you have to monitor the whole node with
>>> monitor_node/2. This makes sense because the OTP ei (C library) or
>>> jinterface do not monitor "processes". Indeed, there is only one pid per
>>> node, which is the node's pseudo-pid (even if technically, each
>>> connection can receive messages). I guess you can draw from the code in
>>> gen.erl if you need to monitor either an erlang process or your java
>>> process, or just monitor the node if you only need to monitor java
>>> processes.
>>>
>>> Regards,
>>>
>>> Paul
>>>
>>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
> 




More information about the erlang-questions mailing list