Fredrik,

I have been using the Erlang/OTP tools (pman, et, etc.) to 
investigate the Yxa application.  I've been writing a trace
tool for et which diagrams the process/message flow.

In order to recognize some of the processes which are spawned
dynamically (e.g. during a transaction) outside of the OTP 
supervision tree I made the attached patch to change from
erlang:spawn[_link]/1,3 to proc_lib:spawn[_link]/1,3.  With
this change I can inspect the system process information and
determine a processes ancestry.  Using proc_lib can help when 
problems arise as well because SASL willl print crash reports.  

If this change doesn't cause adverse effects to existing 
systems it would probably be a good idea to committ it.  The
only problem I would anticipate is increased verbosity.

        -Vance

Index: src/transportlayer/tcp_receiver.erl
===================================================================
--- src/transportlayer/tcp_receiver.erl (revision 1655)
+++ src/transportlayer/tcp_receiver.erl (working copy)
@@ -174,7 +174,7 @@
     Recv = #recv{origin_str    = OriginStr,
                 stun_env       = StunEnv
                },
-    spawn_link(?MODULE, recv_loop, [State, Recv]).
+    proc_lib:spawn_link(?MODULE, recv_loop, [State, Recv]).
 

 %%====================================================================
 %% Internal functions


Index: src/transportlayer/tcp_listener.erl
===================================================================
--- src/transportlayer/tcp_listener.erl (revision 1655)
+++ src/transportlayer/tcp_listener.erl (working copy)
@@ -81,7 +81,7 @@
        true ->
            case lists:keysearch(certfile, 1, Options) of
                {value, _} ->
-                   Pid = spawn_link(?MODULE, start_listening, [Proto, Port, 
InetModule, SocketModule, Options]),
+                   Pid = proc_lib:spawn_link(?MODULE, start_listening, [Proto, 
Port, InetModule, SocketModule, Options]),
                    {ok, Pid};
                false ->
                    logger:log(normal, "NOT starting ~p listener on port ~p, no 
SSL server certificate specified "
@@ -89,7 +89,7 @@
                    ignore
            end;
        false ->
-           Pid = spawn_link(?MODULE, start_listening, [Proto, Port, 
InetModule, SocketModule, Options]),
+           Pid = proc_lib:spawn_link(?MODULE, start_listening, [Proto, Port, 
InetModule, SocketModule, Options]),
            {ok, Pid}
     end.
 

Index: src/sipserver.erl
===================================================================
--- src/sipserver.erl   (revision 1655)
+++ src/sipserver.erl   (working copy)
@@ -332,7 +332,7 @@
 %% @end
 %%--------------------------------------------------------------------
 safe_spawn(Module, Function, Arguments) ->
-    spawn(fun() -> safe_spawn_child(Module, Function, Arguments) end).
+    proc_lib:spawn(fun() -> safe_spawn_child(Module, Function, Arguments) end).
 
 safe_spawn_child(Module, Function, Arguments) ->
     try apply(Module, Function, Arguments) of


_______________________________________________
Yxa-devel mailing list
Yxa-devel@lists.su.se
https://lists.su.se/mailman/listinfo/yxa-devel

Reply via email to