10589

Globally registered process is not registered

I'm using

spawn (node, module, function, Args) global:register_name(name, pid)

To register a process on a different node globally.

Here's the code

Pid = spawn(mi, loop, [X]), io:format("Glavni PID: ~w~n", [Pid]), register(glavni, Pid), Pid1 = spawn (prvi@Molly, mi, loop_prvi, []), io:format("Prvi PID: ~w~n", [Pid1]), global:register_name (prvi, Pid1),

When I run the code, it doesn't throw any error but when I try whereis(process) I get undefined on a node that spawned it.

Here's what process' console says:

Pid = spawn(mi, loop, [X]), io:format("Glavni PID: ~w~n", [Pid]), register(glavni, Pid), Pid1 = spawn (prvi@Molly, mi, loop_prvi, []), io:format("Prvi PID: ~w~n", [Pid1]), global:register_name (prvi, Pid1),

And when I try to whereis(process) from any node, either the master node or the node I created the process on, it says:

(prvi@Molly)2> whereis(prvi). undefined (prvi@Molly)3> whereis(prvi@Molly). undefined

Answer1:

To register on several nodes you have to:

    <li>start sevral nodes</li> <li>ensure they use the same cookie</li> <li>connect them (for example in node A, execute net_adm:ping(B))</li> <li>start a process on node B with spawn(node,...)</li> <li>register it with global:register_name(name, Pid)</li> <li>check the registration with global:whereis_name(name)</li> </ul>

    you miss at least the last point, but all of them are necessary.

Recommend

  • Return value of execl [duplicate]
  • Easy question on how to write my entries as a PHP array
  • Php pdo foreach
  • Does sysfs procfs devtmpfs mounted by kernel?
  • document.getElementById fails to update textbox value
  • join condition “ON” vs in “WHERE”
  • Scala find element in nested List
  • Xamarin: Couldn't find “libmonodroid.so” emulator error
  • do I even need `htmlspecialchars()` for textarea's value
  • How to find the drive letter of an USB mass storage drive using VID and PID in C#?
  • ERROR! The server quit without updating PID file (/usr/local/mysql/data/Mac.local.pid)
  • MPI: Broadcasting a long long int
  • Why can I not read from stdin in this forked process?
  • Getting ORA-01861 - Literal does not match format string on SQLPlus Only
  • Spark Worker asking for absurd amounts of virtual memory
  • Apache shutting down unexpectedly
  • getting the error “ERROR: EOF” when i execute a Heroku command “heroku login” in ubuntu?
  • Bash proper way of printing out an error message
  • SecurityException Permission Denial MediaProvider READ_EXTERNAL_STORAGE
  • How can I write a where clause in SQL to filter a DATETIME column by the time of day?
  • global:whereis_name() returns different Pid from different terminals
  • Upgrade to g++ 4.7 (with c++11 support): any ABI incompatibility?
  • how to show filtered JSON data from two different key values in react native
  • Is there a way to get the process ID of a console program I've just started in the background?
  • css font-size and line-height not matching the baseline
  • Graceful pod termination
  • Simple Distributed Erlang
  • insert a picture into database(sqlite) with java code. what should i do?
  • Find VMID for running instance
  • Getting error java.io.FileNotFoundException (log4j log file) at the time of publish project on cloud
  • Xmonad multiple submap key combos
  • rewrite uppercase url to lowercase url htaccess
  • Mysterious problem with floating point in LISP - time axis generation
  • How to know when stdin is empty if it contains EOF?
  • Font Awesome Showing Box instead of Icons
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Is it possible to post an object from jquery to bottle.py?
  • Reading document lines to the user (python)
  • Python/Django TangoWithDjango Models and Databases