Possible minor bug in AnyEvent :: Impl :: POE -> io

Marc Lehmann schmorp at schmorp.de
Sun Mar 20 21:18:22 CET 2016


On Thu, Mar 17, 2016 at 06:36:03PM +0100, Andreas Breslau <abreslau at smail.uni-koeln.de> wrote:
> In AnyEvent :: Impl :: POE the filehandle ($fh) created in sub io() with
> AnyEvent::_dupfh and passed to POE::Session->create() is not closed/deleted
> in stop => sub {}.

Hi!

It would be a bug if it were closed - but what do you mean with deleted?
Shouldn't POE free resources associated with a session when the session
gets destroyed?

Apparently not, if POE holds to it, but I don't know how to make POE free
resources.

> I fixed this problem for me be by changing the stop callback to:

If you close the fh when the session is destroyed, then the fh is closed
whenever a watcher is destroyed (because the watcher is the session), which
would introduce a bug.

This looks like a bug in POE or maybe in how you use the code - do you have a
small example program that I can check that shows the problem?

> I found no other place where this duped filehandle is closed, so this might
> be a bug which should be fixed.

Perl automatically closes file handles that are destroyed. The problem
you describe happens when something keeps a reference to the fh that
shouldn't.

> Or does this only occur on my system and I missed something?

It doesn't usually depend on your system or configuration, only with how your
program, AnyEvernt or POE behave.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the anyevent mailing list