[erlang-questions] Jinterface receiveRPC bug?

Vlad Dumitrescu vladdu55@REDACTED
Tue May 20 11:21:46 CEST 2014


Hi!

The documentation for receiveRPC states:

     * Receive an RPC reply from the remote Erlang node. This convenience
     * function receives a message from the remote node, and expects it to
have
     * the following format:
     *
     * <pre>
     * { rex, Term }
     * </pre>
     *
     * @return the second element of the tuple if the received message is a
     *         two-tuple, otherwise null. No further error checking is
     *         performed.

So it receives whatever message is in the queue and if it's looking like a
'rex' response, it retruns the value; otherwise it returns null. So yes,
sometimes the returned value may be null. I usually create a mailbox for
each rex request sent - that way it can only receive one message.

The method doesn't even check that the first element is the atom 'rex',
which can result in other kind of errors. This I would categorize as a bug.

regards,
Vlad



On Tue, May 20, 2014 at 11:07 AM, David Welton <davidnwelton@REDACTED>wrote:

> Hi,
>
> Did you ever figure this out?  We're observing some similar behavior
> that's a bit odd.  I'm not the one following the Java code, so I will
> have to ask for some details, but our Java guy is complaining about
> getting null back as well.
>
> It's likely to have something to do with having both receiveRPC and
> other code that also does a receive... at least that's my intuition.
>
> Any guidance on this?
>
> On Fri, Sep 7, 2012 at 12:33 PM, Damian Dobroczyński <qoocku@REDACTED>
> wrote:
> > Hi list!
> >
> > We've found irritating problem with jinterface (R15B01): from time to
> time
> > "receiveRPC()" method returns "null" instead of
> > sensible value. After short digging we've found such scenario:
> >
> > ... sendRPC/receiveRPC
> > [java] erlang Jinterface says: I got: '{rex,['node102@REDACTED']}'
> >
> > ... sendRPC/receiveRPC
> > [java] erlang Jinterface says: I got: '{rex,{jpg,#Bin<32162>}}'
> >
> > ... sendRPC/receiveRPC
> > [java] erlang Jinterface says: I got: '{rex,['node102@REDACTED']}'
> >
> > ... sendRPC/receiveRPC
> > [java] erlang Jinterface says: I got:
> > '{'$gen_call',{#Pid<node106@REDACTED
> >,#Ref<node106@REDACTED>},{is_auth,'node106@REDACTED'}}'
> >
> > ...
> >
> > (we've changed "receiveRPC" method to produce log entries)
> >
> > "{rex, ...} messages are OK. The last one is suprising. Is it proper
> > behavior? I mean, does a Java node receive occasionally "is_auth"
> messages
> > (I think they are related somehow to net_kernel module) ? "node6" IS the
> > node we're connected to.
> >
> > -- D.
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
>
>
>
> --
> David N. Welton
>
> http://www.welton.it/davidw/
>
> http://www.dedasys.com/
> _______________________________________________
> 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/20140520/53ed75cd/attachment.htm>


More information about the erlang-questions mailing list