<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:m = 
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6002.18591" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
        BEHAVIOR: url(#default#VML)
}
o\:* {
        BEHAVIOR: url(#default#VML)
}
w\:* {
        BEHAVIOR: url(#default#VML)
}
.shape {
        BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
        font-family: Cambria;
}
@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Tahoma;
}
@font-face {
        font-family: Consolas;
}
@page WordSection1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Cambria","serif"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Cambria","serif"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Cambria","serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
P {
        FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: "Cambria","serif"; mso-style-priority: 99; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto
}
P.MsoAcetate {
        FONT-SIZE: 8pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Balloon Text Char"
}
LI.MsoAcetate {
        FONT-SIZE: 8pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Balloon Text Char"
}
DIV.MsoAcetate {
        FONT-SIZE: 8pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Balloon Text Char"
}
SPAN.EmailStyle18 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
SPAN.BalloonTextChar {
        FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Balloon Text"; mso-style-name: "Balloon Text Char"
}
.MsoChpDefault {
        FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.WordSection1 {
        page: WordSection1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=661364304-28052012>Is there a way to detect from Erlang that windows just 
woke up from sleeping?</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> David Mercer [mailto:dmercer@gmail.com] 
<BR><B>Sent:</B> Friday, May 25, 2012 20:39<BR><B>To:</B> József Bérces; 
erlang-questions@erlang.org<BR><B>Subject:</B> RE: [erlang-questions] What 
causes nodes to become disconnected/reconnected?<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=WordSection1>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">These 
might be related, though.  You are right, my case does not occur due to the 
host going to sleep, but both my hosts are Windows, and perhaps something is 
happening – whether it be with the network, firewall, virus protection, or 
whatever – that is causing the nodes to get disconnected, and they do not 
properly reconnect when the temporary issue is resolved.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">It 
might be the same thing in the Windows port of Erlang that prevents them from 
reconnecting after sleep that is preventing my nodes from reconnecting after 
something else.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">Cheers,<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">DBM<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0in; BORDER-LEFT: blue 1.5pt solid; PADDING-TOP: 0in; BORDER-BOTTOM: medium none">
<DIV>
<DIV 
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> 
erlang-questions-bounces@erlang.org [mailto:erlang-questions-bounces@erlang.org] 
<B>On Behalf Of </B>József Bérces<BR><B>Sent:</B> Friday, May 25, 2012 4:30 
AM<BR><B>To:</B> erlang-questions@erlang.org<BR><B>Subject:</B> Re: 
[erlang-questions] What causes nodes to become 
disconnected/reconnected?<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">It is 
somewhat offtopic as I do not believe David experenced this, but I have 
similar disconnection when Windows goes to sleep. After the wake-up, the nodes 
do not see each other. Does anyone have any idea how to fix 
this?</SPAN><o:p></o:p></P>
<P class=MsoNormal> <o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Thanks,</SPAN><o:p></o:p></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'">Jozsef</SPAN><o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<DIV class=MsoNormal style="TEXT-ALIGN: center" align=center>
<HR align=center width="100%" SIZE=2>
</DIV>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt"><B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'">From:</SPAN></B><SPAN 
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Tahoma','sans-serif'"> <A 
href="mailto:erlang-questions-bounces@erlang.org">erlang-questions-bounces@erlang.org</A> 
[<A 
href="mailto:erlang-questions-bounces@erlang.org">mailto:erlang-questions-bounces@erlang.org</A>] 
<B>On Behalf Of </B>Martynas Pumputis<BR><B>Sent:</B> Friday, May 25, 2012 
16:24<BR><B>To:</B> David Mercer<BR><B>Cc:</B> <A 
href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</A><BR><B>Subject:</B> 
Re: [erlang-questions] What causes nodes to become 
disconnected/reconnected?</SPAN><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-BOTTOM: 12pt">Erlang doesn't detect net splits 
by itself. You could start looking at net_kernel:set_net_ticktime/2 (try to 
increase this value if your node is suffering from high load/traffic) and 
kernel/src/dist_utils.erl to get a grasp how erlang handles node 
connections.<BR><BR>Martynas<o:p></o:p></P>
<DIV>
<P class=MsoNormal>On Thu, May 24, 2012 at 6:23 PM, David Mercer <<A 
href="mailto:dmercer@gmail.com" target=_blank>dmercer@gmail.com</A>> 
wrote:<o:p></o:p></P>
<DIV>
<DIV>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">(Yes, I am still 
working on my issue with a distributed application that keeps losing its 
connection to the other node.)<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">It is not a 
problem only when I have 2 nodes on the <I>same</I> host.  I was running 
the nodes on <I>different</I> hosts last night, and this morning the failover 
node had lost its connection to the main and so had started its own instance of 
the application.  Calling <SPAN 
style="FONT-FAMILY: Consolas">nodes()</SPAN> on the failover returned <SPAN 
style="FONT-FAMILY: Consolas">[]</SPAN>.<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">Then I started a 
new node on the same host as the main (to see if it would restore the 
connections), and, yes, it did.  After starting the third node, <SPAN 
style="FONT-FAMILY: Consolas">nodes() </SPAN>now on the failover node returns a 
list of two nodes, the two on the main host.  However, the application on 
the failover node did not shut down, and so it is still running on both the main 
and failover nodes.<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">To 
summarize:<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P>1.<SPAN 
style="FONT-SIZE: 7pt; FONT-FAMILY: 'Times New Roman','serif'">       
</SPAN>Distributed application running on a node on host A (“main@A”), failover 
on node on host B (“failover@B”).<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P>2.<SPAN 
style="FONT-SIZE: 7pt; FONT-FAMILY: 'Times New Roman','serif'">       
</SPAN>At some point, <I>failover@B</I> becomes disconnected from <I>main@A</I>, 
and the application starts on <I>failover@B</I>.  Now there are two 
instances of the application running.<o:p></o:p></P>
<P> <o:p></o:p></P>
<P>3.<SPAN 
style="FONT-SIZE: 7pt; FONT-FAMILY: 'Times New Roman','serif'">       
</SPAN>From a network point of view, there is still (or again) a valid network 
connection between hosts A and B.  I can’t say for sure if some 
network/firewall/other issue caused a temporary disconnect, but I can say that 
by the time I got in this morning, when the application was running on both 
nodes, there was a firm network connection between the two hosts.<o:p></o:p></P>
<P> <o:p></o:p></P>
<P>4.<SPAN 
style="FONT-SIZE: 7pt; FONT-FAMILY: 'Times New Roman','serif'">       
</SPAN>Calling <SPAN style="FONT-FAMILY: Consolas">nodes()</SPAN> on 
<I>failover@B</I> returns <SPAN 
style="FONT-FAMILY: Consolas">[]</SPAN>.<o:p></o:p></P>
<P> <o:p></o:p></P>
<P>5.<SPAN 
style="FONT-SIZE: 7pt; FONT-FAMILY: 'Times New Roman','serif'">       
</SPAN>A new (failover) node was started on host A (“failover@A”).  It does 
not start the application (which is correct, since it is already running, albeit 
on <I>both</I> other nodes instead of just one).<o:p></o:p></P>
<P> <o:p></o:p></P>
<P>6.<SPAN 
style="FONT-SIZE: 7pt; FONT-FAMILY: 'Times New Roman','serif'">       
</SPAN>Calling <SPAN style="FONT-FAMILY: Consolas">nodes()</SPAN> on 
<I>failover@B</I> now returns <SPAN 
style="FONT-FAMILY: Consolas">[failover@A,main@A]</SPAN>.<o:p></o:p></P>
<P> <o:p></o:p></P>
<P>7.<SPAN 
style="FONT-SIZE: 7pt; FONT-FAMILY: 'Times New Roman','serif'">       
</SPAN>The application, however, is still running on <I>failover@B</I>, despite 
the fact that nodes/0 reports a connection to <I>main@A</I>.<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">I don’t need 
someone to diagnose this for me.  If someone could just educate me a little 
on how the connections work, how net splits are detected and nodes disconnected, 
etc., I might be able to take it from there.  Anyone know enough and have 
the time to type out a little blurb?  I can read source code, but having a 
little background knowledge would help put it into context for 
me.<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">Thank-you!<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">Cheers,<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto">David<o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P>
<P class=MsoNormal 
style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"> <o:p></o:p></P></DIV></DIV>
<P class=MsoNormal 
style="MARGIN-BOTTOM: 12pt"><BR>_______________________________________________<BR>erlang-questions 
mailing list<BR><A href="mailto:erlang-questions@erlang.org" 
target=_blank>erlang-questions@erlang.org</A><BR><A 
href="http://erlang.org/mailman/listinfo/erlang-questions" 
target=_blank>http://erlang.org/mailman/listinfo/erlang-questions</A><o:p></o:p></P></DIV>
<P class=MsoNormal><o:p> </o:p></P></DIV></DIV></BODY></HTML>