Hey, Nick.  Discontent is the father of invention.

Revision 2098 works around test failures when POE::Wheel::ReadLine's DESTROY calls $poe_kernel->select() and state() outside the proper session context. Certain asserts turn this behavior into hard, fatal errors, and POE's tests usually run with all asserts turned on.

The problem's source is the dynamic pending functions in POE::Wheel::ReadLine. They create closures for $self. The object can't destruct until the functions do, and the functions stored in SELF_PENDING and SELF_PENDING_FN won't until the object does. Perl eventually breaks up this group hug during global destruction just prior to exiting.

Revision 2098 is a complete mistake. I shouldn't have patched over a memory leak, but I justified it by considering that POE::Wheel::ReadLine object lifetimes usually match the entire program using it. Few people would notice it leaking because. I might have gotten away with it, too, if I had remembered to restore the terminal.

I'd like to reverse revision 2098. It may be as easy as ensuring that the SELF_PENDING and SELF_PENDING_FN members are cleaned up when they're not needed. The new ReadLine test should stop blowing up when it's fixed.

--
Rocco Caputo - [EMAIL PROTECTED]

On Sep 19, 2006, at 07:48, Nick Williams wrote:

I now have a new problem (don't I always ;-).

ReadLine has a modification that I didn't spot earlier (due to our inability to use the last few releases) that doesn't make sense to me. The change labelled r2098 (which went into 0.37, I believe) does this:

2006-09-05 01:41:11 (r2098) by rcaputo; poe/lib/POE/Wheel/ ReadLine.pm M

   A cheezy hack to avoid destroying Wheel::ReadLine instances from
   within POE::Kernel's space. A proper fix would be to somehow break
   this wheel's circular references to $self so that DESTROY is
   triggered immediately when the user destroys the objects' last
   references.


I really really don't understand this. The hack is within DESTROY (i.e. it's within the code that's called when the wheel is evaporating: by definition there are no more references). The hack says if we're evaporating and our parent session has already left the building, then we will not do proper DESTROY semantics but will instead return. An important result of this is that we won't bother resetting the terminal mode back to normal. Which means that quite often after using this module, the terminal will be screwed up. This isn't good. A quick hack fix would be to always restore the terminal state before we hit the conditional return. But then it leads me into where I don't understand: why would we not want to do all of the cleanup? Even if the parent is poe_kernel (i.e. our real session parent has already departed), we can still do cleanup. We're in the DESTROY handler! Does it hurt to do any of that cleanup? Is the comment saying something else? I don't understand the reasoning behind this....

Nick


Rocco Caputo wrote:

You have a few hours to perhaps a day or two to prepare yourself for the onslaught of goodness encapsulated in this release. Perhaps most significantly, the two changes you've been waiting for all week (if not longer):

+ The sig() reference count has been removed. There will be much rejoicing, and probably some gnashing of teeth.

+ sig_child($pid, $event) was introduced. It waits for an explicit process ID. It holds a session reference count. It automatically clears after the specified process has been reaped and the event has been delivered.

But that's not all. Other people were busy improving POE while I was distracted by signals fixes. Give a big shout out to:

+ Apocalypse made alias_resolve() failures non-fatal when certain assertions are enabled. Rob Bloodgood reported this problem, and persisted in making sure it was fixed.

+ Vanilla Perl test failures were worked around. That distribution is highly experimental. Its developers don't recommend its use. And it isn't bundled with Win32::Console, needed by the Wheel::Run tests. So those tests are skipped if that module isn't installed.

+ Martijn Van Beers documented some hook methods in POE::Session, improving POE's kwalitee and passing the features on to you!

+ Matt Sickler applied a doc patch for TRACE_STATISTICS, submitted by Joel Bernsein.

And some 0.37 test failures were fixed. And probably other stuff I forgot. That's okay, though. There's a CHANGES file inside the tarball, and it'll be more than happy to explain everything in much greater detail.



Reply via email to