Closed kak-tus closed 7 years ago
I guess I don't fully understand your issue (I don't have time to reproduce at the moment) but it sounds like perhaps you should look at https://metacpan.org/pod/Mojo::Pg::Results#finish .
Problem here is not in non used usual functions (yes, finish will help here). Problem is in using results object in closure function, which is not a good idea, but user can do this. In this case - we have got dbh marked as free, and not finished sth.
Afraid i don't understand the problem either, and i don't think we care too much about AnyEvent specific problems.
Steps to reproduce the behavior
When we using async operations, and got db and results object - we can pass result object to subfunction. After that result object continues to exists, and db - not, so DESTROY on db called and dbh returns to queue. See example code, that reproduce this issue. Code not perfect (normally it's not a good idea to pass results object to subfunction, but it is exists).
Expected behavior
We coud got normal result from second query.
Actual behavior
We got error