How about trying this:
sub future {
my $f = AnyEvent::Future->new;
Carp::cluck("producing new anyevent future $f");
return $f;
}
The trick here is that the message coming from Future's debugging message contains the physical address of the $future and so does the stack trace written by the cluck above.
It helped me a lot to get a bit familiar with the code. Not enough yet, but maybe it helps you too:)
Here is the biography of one of the lost futures:
producing new anyevent future AnyEvent::Future=HASH(0x3964798) at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/Chrome/DevToolsProtocol/Transport/AnyEvent.pm line 91, <$server> line 1.
Chrome::DevToolsProtocol::Transport::AnyEvent::future(Chrome::DevToolsProtocol::Transport::AnyEvent=HASH(0x384bed8)) called at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/Chrome/DevToolsProtocol.pm line 226
Chrome::DevToolsProtocol::one_shot(Chrome::DevToolsProtocol=HASH(0x1a60168), "DOM.setChildNodes") called at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/WWW/Mechanize/Chrome.pm line 2058
WWW::Mechanize::Chrome::__ANON__(HASH(0x2605928)) called at /usr/share/perl5/Future.pm line 436
eval {...} called at /usr/share/perl5/Future.pm line 436
Future::_mark_ready(AnyEvent::Future=HASH(0x2610b98), "done") called at /usr/share/perl5/Future.pm line 508
Future::done(AnyEvent::Future=HASH(0x2610b98), HASH(0x2605928)) called at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/Chrome/DevToolsProtocol.pm line 305
Chrome::DevToolsProtocol::on_response(Chrome::DevToolsProtocol=HASH(0x1a60168), AnyEvent::WebSocket::Connection=HASH(0x3843540), "{\"id\":7,\"result\":{\"searchId\":\"17531.23\",\"resultCount\":1}}") called at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/Chrome/DevToolsProtocol/Transport/AnyEvent.pm line 67
Chrome::DevToolsProtocol::Transport::AnyEvent::__ANON__(AnyEvent::WebSocket::Connection=HASH(0x3843540), AnyEvent::WebSocket::Message=HASH(0x39645e8)) called at /home/andk/perl5/lib/perl5/AnyEvent/WebSocket/Connection.pm line 170
AnyEvent::WebSocket::Connection::_process_message(AnyEvent::WebSocket::Connection=HASH(0x3843540), AnyEvent::WebSocket::Message=HASH(0x39645e8)) called at /home/andk/perl5/lib/perl5/AnyEvent/WebSocket/Connection.pm line 104
eval {...} called at /home/andk/perl5/lib/perl5/AnyEvent/WebSocket/Connection.pm line 95
AnyEvent::WebSocket::Connection::__ANON__(AnyEvent::Handle=HASH(0x26056d0)) called at /home/andk/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/AnyEvent/Handle.pm line 1327
AnyEvent::Handle::_drain_rbuf(AnyEvent::Handle=HASH(0x26056d0)) called at /home/andk/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/AnyEvent/Handle.pm line 2015
AnyEvent::Handle::__ANON__(EV::IO=SCALAR(0x3890828), 1) called at /home/andk/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/AnyEvent/Impl/EV.pm line 88
eval {...} called at /home/andk/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/AnyEvent/Impl/EV.pm line 88
AnyEvent::CondVar::Base::_wait(AnyEvent::CondVar=HASH(0x25c1448)) called at /home/andk/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/AnyEvent.pm line 2023
AnyEvent::CondVar::Base::recv(AnyEvent::CondVar=HASH(0x25c1448)) called at /home/andk/perl5/lib/perl5/AnyEvent/Future.pm line 178
AnyEvent::Future::await(AnyEvent::Future=HASH(0x3967b20)) called at /usr/share/perl5/Future.pm line 774
Future::get(AnyEvent::Future=HASH(0x3967b20)) called at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/WWW/Mechanize/Chrome.pm line 2205
WWW::Mechanize::Chrome::xpath(WWW::Mechanize::Chrome=HASH(0x1b9c2e0), "(//form)[1]", "user_info", "form number 1", "single", 1) called at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/WWW/Mechanize/Chrome.pm line 2599
WWW::Mechanize::Chrome::form_number(WWW::Mechanize::Chrome=HASH(0x1b9c2e0), 1) called at /home/andk/src/WWW-Mechanize-Chrome/blib/lib/WWW/Mechanize/Chrome.pm line 2487
WWW::Mechanize::Chrome::current_form(WWW::Mechanize::Chrome=HASH(0x1b9c2e0)) called at t/50-form2.t line 41
main::__ANON__("/usr/bin/google-chrome-stable", WWW::Mechanize::Chrome=HASH(0x1b9c2e0)) called at t/helper.pm line 106
t::helper::run_across_instances(ARRAY(0xe6d110), 9222, CODE(0x22d3488), 13, CODE(0x22d3638)) called at t/50-form2.t line 78