I hope it's not bad form to post this to two places at once. I already put this on stack overflow but I figured I might get a better response here. Anyway:<div><br></div><div><div>I have a process that lots of threads make links to in order to associate themselves with this process. I made the system this way so that at any time I can easily see who is associated to the central process without having to also keep track of any lists inside of the application itself. I can simply do process_info(self(),links) and erlang keeps track of which processes are still alive or not, etc....</div>
<div><br></div><div>At least, I thought so, until I found out that the list being returned on this thread isn't accurate at this moment:</div></div><div><br></div><div><div>% P is my central pid</div><div>(node@host)212> P.</div>
<div><0.803.0></div><div><br></div><div>% Get all the links to it</div><div>(node@host)213> {links,L} = process_info(P,links).</div><div>{links,[<0.29179.155>,<0.6492.250>,<0.29990.293>|...]}</div>
<div><br></div><div>% Counting out all the links</div><div>(node@host)214> length(L).</div><div>31154</div><div><br></div><div>% Filtering out all of the dead processes, put them in Lf</div><div>(node@host)215> Lf = lists:filter(fun(Pid) -> try process_info(Pid,links) of {links,_} -> true; _ -> false catch _:_ -> false end end, L).</div>
<div>[<0.29179.155>,<0.6492.250>,<0.29990.293>,<0.23619.530>|...]</div><div><br></div><div>% Lf is only about half the size, half the linked processes are dead!</div><div>(node@host)216> length(Lf).</div>
<div>15654</div><div><br></div><div>% Proof that the links haven't changed in the interim</div><div>(node@host)217> {links,L} = process_info(P,links).</div><div>{links,[<0.29179.155>,<0.6492.250>,<0.29990.293>|...]}</div>
</div><div><br></div><div><br></div><div><div>The only thing I can think of that would cause this is network connectivity issues, since some of the links may come from threads on a node on another machine. Is that a possible explanation for this? And is there a way to make the thread clean up its link list?</div>
</div>