[erlang-questions] Who called my gen_server?

Andreas Schultz aschultz@REDACTED
Thu Apr 27 10:11:55 CEST 2017

Hi Frank, 

----- On Apr 27, 2017, at 9:49 AM, Frank Muller <frank.muller.erl@REDACTED> wrote: 

> Hi Andreas,

> No I didn't know that issue with "rpc".

> But is switching to a different solution as you mentioned (gproc, etc.) will
> help me solve "the who's calling me"?

Only for handle_call case. handle_cast and handle_info won't get that information. You have to include 
the source in the actual message you are sending. 


> /Frank

> Schultz< [ mailto:aschultz@REDACTED | aschultz@REDACTED ] > wrote :

>> Hi,

>> ----- On Apr 24, 2017, at 5:43 PM, Frank Muller < [
>> mailto:frank.muller.erl@REDACTED | frank.muller.erl@REDACTED ] > wrote:

>>> Hi guys,

>>> I've two connected nodes: N1, N2.

>>> N1 is mine and I've a gen_server running on it.
>>> N2 is external and doesn't belong to me.

>>> A process on N2 is calling my gen_server (on N1) via an rpc:call.

>> You do know that the rpc server is exactly one process per Erlang
>> node. Pushing to many calls through it will degrade performance.

>> If you have any influence on the design of node N2, change it to call
>> your N1 gen_server directly without the intermediate rpc process.

>> You could either register your server with a global name, use another
>> global registry (e.g. gproc), or a myriad of other ways to reach your
>> gen_server without the rpc module.

>> That way, `From` in the handle_call method will contain the PID of
>> the caller.

>> Andreas

>>> Is there a way to know the Pid of that process?
>>> Or, can I log all rpc_call(s) calling my gen_server?

>>> /Frank

>>> _______________________________________________
>>> erlang-questions mailing list
>>> [ mailto:erlang-questions@REDACTED | erlang-questions@REDACTED ]
>>> [ http://erlang.org/mailman/listinfo/erlang-questions |
>>> http://erlang.org/mailman/listinfo/erlang-questions ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170427/544fa5db/attachment.htm>

More information about the erlang-questions mailing list