DESTROY issues
Henrik Pauli
henrik.pauli at gmail.com
Sat Nov 10 13:36:17 CET 2012
Hello,
I'm using AnyEvent inside Gtk2's main loop, for HTTP RPC that doesn't
block the UI. For certain reasons such as an ancient GTK+, I couldn't
use Gtk's own libsoup for this but AnyEvent::HTTP seems to work just fine.
Except when I'm quitting the app, sometimes (but not always), I get the
following traceback:
== Stack trace ==
AnyEvent/Handle.pm:2163, module AnyEvent::Handle, sub main::__ANON__
AnyEvent/Handle.pm:2185, module AnyEvent::Handle, sub
AnyEvent::Handle::_freetls
calgo:0, module main, sub AnyEvent::Handle::DESTROY
calgo:0, module main, sub (eval)
== Croak message ==
Can't call method "_put_session" on an undefined value at
AnyEvent/Handle.pm line 2163 during global destruction.
Yeah, so last time I reported weird behaviour due to our DIE handler not
working well inside evals, and you pointed it out to me that the DIE
handler was broken, so I did attempt to fix it and the problems are
indeed gone. Not sure if it's still broken, but right now this is the
only unexplainable croaking from it.
I have a little object $api that implements a single call() method that
simplifies the RPC/API calls. Within itself, it uses AnyEvent::HTTP and
some non-communication internals of the LWP bundle to more easily manage
HTTP requests and responses, and to implement Digest authentication.
$api is instantiated once, and gets destroyed at the end. I guess this
is when this discrepancy happens about the destroying of the underlying
AnyEvent::Handle.
I'm curious about what I could do to guard against it — maybe by
manually destroying the handle before exiting, something along those
lines. So, any ideas?
Thanks,
H.
More information about the anyevent
mailing list