<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3395" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=259495911-22092008>Hi Edwin,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=259495911-22092008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=259495911-22092008>Thanks for the advice!</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=259495911-22092008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=259495911-22092008>I think you may be correct in
that it appears the second process is dying shortly after being
started - the log is indicating it is being started! (they don't register
themselves)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=259495911-22092008></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=259495911-22092008>Slightly off-topic, any ideas why the appmon uses such
a large amount of memory when switching to sup view from proc?
</SPAN></FONT></DIV><!--eMS5.0.5.D22M.9Y.2008-->
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=259495911-22092008><FONT face=Arial color=#0000ff size=2>Many
thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=259495911-22092008><FONT face=Arial color=#0000ff
size=2>Dan</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> emofine@gmail.com
[mailto:emofine@gmail.com] <B>On Behalf Of </B>Edwin Fine<BR><B>Sent:</B> 22
September 2008 12:27<BR><B>To:</B> RUBINO, Dana, GBM<BR><B>Cc:</B>
erlang-questions@erlang.org<BR><B>Subject:</B> Re: [erlang-questions] Gen
supervisor query...<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>Hi Dan<BR><BR>The first thing that comes to mind is, does the
generic_tcp_server register itself? If so, the second one will fail to start. Do
you see any error messages? I find if you start SASL before you run your
program, you may get better error information (application:start(sasl), or -boot
sasl on the command line). Anotyher possibility is, could one of them have died
before you looked in appmon? What does your output/error log look
like?<BR><BR>The other thing is, instead of explicitly looking in registered()
for your connection monitor, you coud just use whereis():<BR><BR><SPAN
style="FONT-FAMILY: courier new,monospace">case whereis(<FONT
size=2>?CONNCOUNTER) of<BR> undefined -> % Not
registered<BR> </FONT></SPAN><FONT
style="FONT-FAMILY: courier new,monospace"
size=2><SPAN></SPAN>register(?CONNCOUNTER, spawn(fun() -> counter(0,
MaxConnections) end)),</FONT><FONT style="FONT-FAMILY: courier new,monospace"
size=2><BR> error_logger:info_msg("TCP
server <~p> started TCP connection monitor.~n", [self()])</FONT><SPAN
style="FONT-FAMILY: courier new,monospace">;</SPAN><BR
style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace"> Pid
-></SPAN><BR style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace"><FONT
size=2>
error_logger:info_msg(<BR>
"TCP connection monitor (~p) already registered as ~p
...SKIPPING~n",<BR>
[?CONNCOUNTER, Pid]<BR>
)</FONT></SPAN><BR style="FONT-FAMILY: courier new,monospace"><SPAN
style="FONT-FAMILY: courier new,monospace">end</SPAN><BR><BR>Hope this
helps.<BR><BR>
<DIV class=gmail_quote>2008/9/22 <SPAN dir=ltr><<A
href="mailto:Dana.RUBINO@rbs.com">Dana.RUBINO@rbs.com</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><SPAN><FONT face=Arial size=2>Hi all,</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial size=2>I have a simple supervisor setup which is
watching two worker processes.</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial size=2></FONT></SPAN> </DIV>
<DIV><SPAN><FONT face=Arial size=2>Now I have created the init method as
such:</FONT></SPAN></DIV>
<DIV><SPAN><FONT face=Arial size=2></FONT></SPAN> </DIV>
<DIV><SPAN>
<P align=left><FONT size=2>init(Args) -></FONT></P>
<P align=left><FONT size=2><SPAN>
</SPAN>[{port,Port},{maxconns, MaxConnections},{sockethandlermod,
SocketHandlerMod}] = Args,</FONT></P>
<P align=left><FONT size=2></FONT></P>
<P align=left><FONT size=2><SPAN> </SPAN>Registered =
registered(),</FONT></P>
<P align=left><FONT size=2><SPAN> </SPAN>case
lists:any(fun(X) -> X =:= ?CONNCOUNTER end, Registered) of</FONT></P>
<P align=left><FONT size=2><SPAN>
</SPAN>true -> </FONT></P>
<P align=left><FONT
size=2><SPAN>
</SPAN>error_logger:info_msg("TCP connection monitor (~p) already
registered...SKIPPING~n",[?CONNCOUNTER]);</FONT></P>
<P align=left><FONT size=2><SPAN>
</SPAN>false -> </FONT></P>
<P align=left><FONT
size=2><SPAN>
</SPAN>register(?CONNCOUNTER, spawn(fun() -> counter(0, MaxConnections)
end)),</FONT></P>
<P align=left><FONT
size=2><SPAN>
</SPAN>error_logger:info_msg("TCP server <~p> started TCP connection
monitor.~n", [self()])</FONT></P>
<P align=left><FONT size=2>end,</FONT></P>
<P align=left><FONT size=2></FONT> </P>
<P align=left><FONT size=2>GenTcpServer1 =
{'GenTcpServer1',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},</FONT><FONT
size=2>permanent,2000,worker,[generic_tcp_server]},</FONT></P>
<P align=left><FONT size=2></FONT></P>
<P align=left><FONT size=2>GenTcpServer2 =
{'GenTcpServer2',{generic_tcp_server,start_link,[Port,SocketHandlerMod]},</FONT><FONT
size=2>permanent,2000,worker,[generic_tcp_server]},</FONT></P>
<P align=left><FONT size=2></FONT></P>
<P><FONT size=2>{ok,{{one_for_one,0,1}, [GenTcpServer1,
GenTcpServer2]}}.</FONT></P></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT
size=2><SPAN>N</SPAN>othing fancy going on there - I would expect this supervisor to start both GenTcpServer1 AND GenTcpServer2 given two speca have been returned?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>F<SPAN>or some reason it is only starting one when I look in
appmon etc.</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN>Any thoughts?</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN>Many Thanks,</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN>Dan</SPAN></FONT></DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><PRE>***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.
Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
Visit our websites at:
<A href="http://www.rbs.com" target=_blank>www.rbs.com</A>
<A href="http://www.rbs.com/gbm" target=_blank>www.rbs.com/gbm</A>
<A href="http://www.rbsgc.com" target=_blank>www.rbsgc.com</A>
***********************************************************************************
</PRE></DIV><BR>_______________________________________________<BR>erlang-questions
mailing list<BR><A
href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</A><BR><A
href="http://www.erlang.org/mailman/listinfo/erlang-questions"
target=_blank>http://www.erlang.org/mailman/listinfo/erlang-questions</A><BR></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>