Re: POE::Kernel->stop() will trigger _stop in the next release
Rocco Caputo <[email protected]> Wed, 11 Nov 2015 21:01:31 -0500
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_F31ECB60-0A0B-4FAD-9F44-4DED52B17302 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi. With the limited information I have, I'm guessing that you have = _stop handlers with side effects that affect resources shared between = parent and child. For example, shutting down a socket that the parent = still needs. I wouldn't limit my investigation to that scope, but I = would start there. --=20 Rocco Caputo <[email protected]> > On Nov 11, 2015, at 19:31, Deven Parekh <[email protected]> = wrote: >=20 > Hello, >=20 > Thank you for the quick response. >=20 > I will try to generate a test case for the above. >=20 > In the mean time if this helps, I did a hand edit to the stop = subroutine in POE::Kernel and replaced=20 >=20 > $self->_data_ses_stop($session->ID); >=20 > (which appears in the latest version ) >=20 > with=20 >=20 > $self->_data_ses_free($session->ID); >=20 > (which was how it was in previous version) >=20 > and the program is working as expected now. >=20 >=20 > I will try to generate a test case and send it for debugging. >=20 > Thanks in advance, >=20 > Best Regards. >=20 > On Tue, Nov 10, 2015 at 2:53 PM, Rocco Caputo <[email protected] = <mailto:[email protected]>> wrote: > I don't expect the change to cause the behavior you've reported. >=20 > If you can reduce your program to a self-contained test case, = something I can run myself using only easily installed, public = dependencies, I can investigate what happened. >=20 > --=20 > Rocco Caputo <[email protected] <mailto:[email protected]>> >=20 >> On Nov 10, 2015, at 15:12, Deven Parekh <[email protected] = <mailto:[email protected]>> wrote: >>=20 >> Hello, >>=20 >> Is it possible that it breaks the following capability of = POE::Wheel::Run >> Running POE::Kernel in the Child <> >> Calling POE::Kernel->run() in the child process effectively resumes = the copy of the parent process. This is rarely (if ever) desired. >>=20 >> More commonly, an application wants to run an entirely new = POE::Kernel instance in the child process. This is supported by first = stop()ping the copied instance, starting one or more new sessions, and = calling run() again. For example: >>=20 >> Program =3D> sub { >> # Wipe the existing POE::Kernel clean. >> $poe_kernel->stop(); >>=20 >> # Start a new session, or more. >> POE::Session->create( >> ... >> ); >>=20 >> # Run the new sessions. >> POE::Kernel->run(); >> } >>=20 >> I had a program that used the above construct which works fine with >> POE =3D> $VERSION =3D '1.354'; >> POE::Wheel::Run =3D> $VERSION =3D '1.354'; >>=20 >>=20 >> However with=20 >> POE =3D> $VERSION =3D '1.367'; >> POE::Wheel::Run =3D> $VERSION =3D '1.367'; >>=20 >> It seems calling POE::Kernel->stop(); it stops the POE::Kernel = instance in parent as well. >>=20 >> Just wondering if the above change could be causing this behaviour = (?) >>=20 >> Thanks in advance. >> Best Regards >>=20 >>=20 >>=20 >> On Thu, Oct 30, 2014 at 4:00 PM, Rocco Caputo <[email protected] = <mailto:[email protected]>> wrote: >> Hello, everyone. I hope you've been well. >>=20 >> It's come to my attention that POE::Kernel->stop() isn't triggering = _stop handlers. This seems wrong, so I've changed it. I hope it = doesn't break anything, but I'm mentioning it here in case people want = to check in advance of a release. >>=20 >> I've already run it past irc.perl.org <http://irc.perl.org/> #poe, = and nobody objected. >>=20 >> -- >> Rocco Caputo <[email protected] <mailto:[email protected]>> >>=20 >=20 >=20 --Apple-Mail=_F31ECB60-0A0B-4FAD-9F44-4DED52B17302 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" = class=3D"">Hi. With the limited information I have, I'm guessing = that you have _stop handlers with side effects that affect resources = shared between parent and child. For example, shutting down a = socket that the parent still needs. I wouldn't limit my = investigation to that scope, but I would start there.<div class=3D""><br = class=3D""><div apple-content-edited=3D"true" class=3D""> <span class=3D"Apple-style-span" style=3D"border-collapse: separate; = color: rgb(0, 0, 0); font-family: Monaco; font-style: normal; = font-variant: normal; font-weight: normal; letter-spacing: normal; = line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; = text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; = -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: = 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: = auto; -webkit-text-stroke-width: 0px; "><div = class=3D"">-- </div><div class=3D"">Rocco Caputo <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>></div></span> </div> <br class=3D""><div><blockquote type=3D"cite" class=3D""><div = class=3D"">On Nov 11, 2015, at 19:31, Deven Parekh <<a = href=3D"mailto:[email protected]" = class=3D"">[email protected]</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><meta = http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" = class=3D""><div dir=3D"ltr" class=3D""><div class=3D""><div = class=3D""><div class=3D""><div class=3D""><div class=3D""><div = class=3D""><div class=3D""><div class=3D"">Hello,<br class=3D""><br = class=3D"">Thank you for the quick response.<br class=3D""><br = class=3D""></div>I will try to generate a test case for the above.<br = class=3D""><br class=3D""></div>In the mean time if this helps, I did a = hand edit to the stop subroutine in POE::Kernel and replaced <br = class=3D""><br class=3D"">$self->_data_ses_stop($session->ID);<br = class=3D""><br class=3D""></div><div class=3D"">(which appears in the = latest version )<br class=3D""></div><div class=3D""><br = class=3D""></div><div class=3D"">with <br class=3D""><br = class=3D"">$self->_data_ses_free($session->ID);<br = class=3D""></div><div class=3D""><br class=3D""></div>(which was how it = was in previous version)<br class=3D""><br class=3D""></div>and the = program is working as expected now.<br class=3D""><br = class=3D""></div><div class=3D""><br class=3D""></div>I will try to = generate a test case and send it for debugging.<br class=3D""><br = class=3D""></div>Thanks in advance,<br class=3D""><br = class=3D""></div>Best Regards.<br class=3D""></div></div><div = class=3D"gmail_extra"><br class=3D""><div class=3D"gmail_quote">On Tue, = Nov 10, 2015 at 2:53 PM, Rocco Caputo <span dir=3D"ltr" class=3D""><<a = href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a>></span> wrote:<br = class=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 = .8ex;border-left:1px #ccc solid;padding-left:1ex"><div = style=3D"word-wrap:break-word" class=3D""><div class=3D"">I don't expect = the change to cause the behavior you've reported.</div><div class=3D""><br= class=3D""></div><div class=3D"">If you can reduce your program to a = self-contained test case, something I can run myself using only easily = installed, public dependencies, I can investigate what = happened.</div><div class=3D""><span class=3D"HOEnZb"><font = color=3D"#888888" class=3D""><br class=3D""><div class=3D""> <span style=3D"border-collapse: separate; font-family: Monaco; = font-style: normal; font-variant: normal; font-weight: normal; = letter-spacing: normal; line-height: normal; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px;" = class=3D""><div class=3D"">-- </div><div class=3D"">Rocco Caputo = <<a href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a>></div></span> </div></font></span><div class=3D""><div class=3D"h5"> <br class=3D""><div class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On Nov 10, 2015, at 15:12, Deven Parekh <<a = href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a>> wrote:</div><br class=3D""><div = class=3D""><div dir=3D"ltr" class=3D""><div class=3D"">Hello,<br = class=3D""><br class=3D""></div>Is it possible that it breaks the = following capability of POE::Wheel::Run<br class=3D""><h3 class=3D""><a = name=3D"150f32d7e04f3724_Running_POE::Kernel_in_the_Child" = class=3D"">Running POE::Kernel in the Child</a></h3><p class=3D"">Calling = <code class=3D"">POE::Kernel->run()</code> in the child process = effectively resumes the copy of the parent process. This is rarely (if = ever) desired.</p><p class=3D"">More commonly, an application wants to = run an entirely new=20 POE::Kernel instance in the child process. This is supported by first=20 stop()ping the copied instance, starting one or more new sessions, and=20= calling run() again. For example:</p> <pre class=3D""> Program <span class=3D"">=3D></span> <span = class=3D"">sub</span> <span class=3D"">{</span> <span class=3D""># Wipe the existing POE::Kernel clean.</span> <span class=3D"">$poe_kernel</span><span class=3D"">-></span><span = class=3D"">stop</span><span class=3D"">();</span> <span class=3D""># Start a new session, or more.</span> POE<span class=3D"">::</span>Session<span class=3D"">-></span><span= class=3D"">create</span><span class=3D"">(</span> <span class=3D"">...</span> <span class=3D"">);</span> <span class=3D""># Run the new sessions.</span> POE<span class=3D"">::</span>Kernel<span class=3D"">-></span><span = class=3D"">run</span><span class=3D"">();</span> <span class=3D"">}<br class=3D""><br class=3D""></span></pre><pre = class=3D""><span class=3D"">I had a program that used the above = construct which works fine with<br class=3D""></span></pre><pre = class=3D""><span class=3D"">POE =3D> $VERSION =3D '1.354';<br = class=3D""></span></pre><pre class=3D""><span class=3D"">POE::Wheel::Run = =3D> $VERSION =3D '1.354';<br class=3D""><br class=3D""><br = class=3D""></span></pre><pre class=3D""><span class=3D"">However with = <br class=3D""></span></pre><pre class=3D""><span class=3D"">POE =3D> = </span><span class=3D"">$VERSION =3D '1.367';<br class=3D""></span><span = class=3D"">POE::Wheel::Run =3D> $VERSION =3D '1.367';<br class=3D""><br= class=3D""></span></pre><pre class=3D""><span class=3D"">It seems = calling POE::Kernel->stop(); it stops the POE::Kernel instance in = parent as well.<br class=3D""><br class=3D""></span></pre><pre = class=3D""><span class=3D"">Just wondering if the above change could be = causing this behaviour (?)<br class=3D""><br class=3D""></span></pre><pre = class=3D""><span class=3D"">Thanks in advance.<br = class=3D""></span></pre><pre class=3D""><span class=3D"">Best Regards<br = class=3D""></span></pre><pre class=3D""><span class=3D""><br = class=3D""></span></pre><br class=3D""></div><div = class=3D"gmail_extra"><br class=3D""><div class=3D"gmail_quote">On Thu, = Oct 30, 2014 at 4:00 PM, Rocco Caputo <span dir=3D"ltr" class=3D""><<a = href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a>></span> wrote:<br = class=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 = .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, everyone. = I hope you've been well.<br class=3D""> <br class=3D""> It's come to my attention that POE::Kernel->stop() isn't triggering = _stop handlers. This seems wrong, so I've changed it. I hope = it doesn't break anything, but I'm mentioning it here in case people = want to check in advance of a release.<br class=3D""> <br class=3D""> I've already run it past <a href=3D"http://irc.perl.org/" = rel=3D"noreferrer" target=3D"_blank" class=3D"">irc.perl.org</a> #poe, = and nobody objected.<br class=3D""> <span class=3D""><font color=3D"#888888" class=3D""><br class=3D""> --<br class=3D""> Rocco Caputo <<a href=3D"mailto:[email protected]" target=3D"_blank" = class=3D"">[email protected]</a>></font></span></blockquote></div><br = class=3D""></div> </div></blockquote></div><br = class=3D""></div></div></div></div></blockquote></div><br = class=3D""></div> </div></blockquote></div><br class=3D""></div></body></html>= --Apple-Mail=_F31ECB60-0A0B-4FAD-9F44-4DED52B17302--