This is a multi-part message in MIME format.

------extPart_000_0154_01C9EAFB.0E907990
Content-Type: text/plain;
	charsets-ascii"
Content-Transfer-Encoding: 7bit

Hello,

 

In my Ruby application, I accept TCP connections from several clients. When
any client sends a particular command, I want to perform a "live reboot" in
which I re-launch the Ruby interpreter against the source of the server,
picking up any code changes that I've made, without disconnecting any of the
clients. So for that reason and because I'd really like this scenario to
work on native Windows (no cygwin), I can't use fork().

 

This works on Linux by persisting socket.fileno from the parent process and
calling TCPSocket.for_fd in the child process. On Windows, some tweaks to
this approach (wrapping _get_osfhandle and _open_osfhandle) will get me most
of the way there, but still falls a little short. I've done enough debugging
to point out the code/design in the Ruby source that is causing this
failure, in case you'd like me to explain. I'm not committed to this
approach, but I haven't been able to think of another one.

 

Is this a scenario that just flat out will not or cannot be supported on
Windows? I've been able to get this nearly working, and it's definitely
possible to do this with straight C++ on Windows, so it shouldn't be a
technical limitation.

 

Or can someone think of another approach to do this?

 

Thanks

-K


------extPart_000_0154_01C9EAFB.0E907990
Content-Type: text/html;
	charsets-ascii"
Content-Transfer-Encoding: quoted-printable

<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:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:odc="urn:schemas-microsoft-com:office:odc" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rtc="http://microsoft.com/officenet/conferencing" xmlns:D="DAV:" xmlns:Repl="http://schemas.microsoft.com/repl/" xmlns:mt="http://schemas.microsoft.com/sharepoint/soap/meetings/" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ppda="http://www.passport.com/NameSpace.xsd" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/"mlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcs="http://schemas.microsoft.com/data/udc/soap" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:udcp2p="http://schemas.microsoft.com/data/udc/parttopart" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:dsss="http://schemas.microsoft.com/office/2006/digsig-setup" xmlns:dssi="http://schemas.microsoft.com/office/2006/digsig" xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:spwp="http://microsoft.com/sharepoint/webpartpages" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types"mlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:pptsl="http://schemas.microsoft.com/sharepoint/soap/SlideLibrary/" xmlns:spsl="http://microsoft.com/webservices/SharePointPortalServer/PublishedLinksService" xmlns:Z="urn:schemas-microsoft-com:" xmlns:st="&#1;" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:"Lucida Console";
	panose-1:2 11 6 9 4 5 4 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Lucida Console";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
	{page:Section1;}
-->
</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 link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>Hello,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>In
my Ruby application, I accept TCP connections from several clients. When any
client sends a particular command, I want to perform a &#8220;live
reboot&#8221; in which I re-launch the Ruby interpreter against the source of
the server, picking up any code changes that I&#8217;ve made, without
disconnecting any of the clients. So for that reason and because I&#8217;d
really like this scenario to work on native Windows (no cygwin), I can&#8217;t
use fork().<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>This
works on Linux by persisting socket.fileno from the parent process and calling
TCPSocket.for_fd in the child process. On Windows, some tweaks to this approach
(wrapping _get_osfhandle and _open_osfhandle) will get me most of the way
there, but still falls a little short. I&#8217;ve done enough debugging to
point out the code/design in the Ruby source that is causing this failure, in
case you&#8217;d like me to explain. I&#8217;m not committed to this approach,
but I haven&#8217;t been able to think of another one.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>Is
this a scenario that just flat out will not or cannot be supported on Windows?
I&#8217;ve been able to get this nearly working, and it&#8217;s definitely
possible to do this with straight C++ on Windows, so it shouldn&#8217;t be a
technical limitation.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>Or
can someone think of another approach to do this?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>Thanks<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Lucida Console"'>-K<o:p></o:p></span></p>

</div>

</body>

</html>

------extPart_000_0154_01C9EAFB.0E907990--