5

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 :)

Vaandu
  • 4,857
  • 12
  • 49
  • 75
ruanhao
  • 4,663
  • 6
  • 28
  • 43

2 Answers2

5

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

Alexey Kachayev
  • 6,106
  • 27
  • 24
  • 2
    As links are bidirectional and monitoring is single directional. – rvirding May 14 '13 at 13:12
  • Thank you Kachayew! Then, such form of process identifier can only be seen in erl_crash.dump, right? i can not see them use process_info(), am i right? – ruanhao May 14 '13 at 13:55
  • @rHao1116 You can use ``process_info`` function in order to get information about process with given PID. – Alexey Kachayev May 15 '13 at 06:39
  • As a side note, here is a shell script to analyze crash dumps to extract generally useful information: https://github.com/ferd/erl_crashdump_analyzer – Roberto Aloi May 15 '13 at 07:36
  • Thank you guys. I found that this special form of pid is due to monitoring. But it can only be seen in erl_crash.dump. If just process_info(Pid), you will see the normal one. – ruanhao May 16 '13 at 11:54
1

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

gladiator
  • 56
  • 1
  • 2