Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Erlang: what is this process identifier in the form of {from, Pid, Ref}?

Tags:

erlang

I am now facing a problem. when i check the erl_crash.dump, i found some stuff as below:

=proc:<0.19275.17>  
State: Scheduled  
Spawned as: proc_lib:init_p/5  
Spawned by: <0.18723.17>  
Started: Wed May 8 13:30:40 2013  
Message queue length: 1  
Number of heap fragments: 0  
Heap fragment data: 0  
Link list: [<0.20051.17>, <0.9976.18>, ..., **{from,<6524.13.0>,#Ref<6524.0.1.37040>}, {from,<6474.13.0>,#Ref<6474.0.1.36682>}, {from,<6470.13.0>,#Ref<6470.0.1.34219>}**, ...]

there is something like {from, Pid, Ref} in the link list of the proc <0.19275.17>. i have no idea what these weird formed processes identifier are. i guess maybe it is related to "process monitoring". am i right? and i still want to know how can i generate such a process identifier and how can i make use of them ?

Thank you in advance :)

like image 916
ruanhao Avatar asked May 14 '13 03:05

ruanhao


2 Answers

This means that the process was monitored by other processes. From documentation:

If process monitoring is used, this field also tells in which direction the monitoring is in effect, i.e., a link being "to" a process tells you that the "current" process was monitoring the other and a link "from" a process tells you that the other process was monitoring the current one.

You can find more infromation here

like image 106
Alexey Kachayev Avatar answered Oct 11 '22 15:10

Alexey Kachayev


I think {from,<6524.13.0>,#Ref<6524.0.1.37040>} is that you register a global name, so global name server is monitoring this process.

more info: http://www.erlang.org/doc/man/global.html

like image 20
gladiator Avatar answered Oct 11 '22 16:10

gladiator