Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^6: How should a fork of DBIx::Simple be handled? (selective comprehension)

by metaperl (Curate)
on Aug 31, 2011 at 16:21 UTC ( #923464=note: print w/ replies, xml ) Need Help??


in reply to Re^5: How should a fork of DBIx::Simple be handled? (selective comprehension)
in thread How should a fork of DBIx::Simple be handled?

Are you going to call your fork DBIx::Simple::CircularReferences or DBIx::Simple::NeverDestroys?
LOL! your research concluded that my fix does indeed prevent a bunch of stuff from being cleaned up until Perl's "global destruction". which is fine with me. you can see my reasoning on reference count and I dont really see anything wrong with it, do you?
What I "saw" was that you should simply stop writing code that destroys the container object if you want to keep using one of the contained objects.
Are you implying that my method chaining and the resulting destruction was unsound?
Unless you proposed a patch that fixed your "bug" without creating circular references
Did you demonstrate that my patch creates circular references?


Comment on Re^6: How should a fork of DBIx::Simple be handled? (selective comprehension)
Re^7: How should a fork of DBIx::Simple be handled? (selective comprehension)
by tye (Cardinal) on Aug 31, 2011 at 18:44 UTC
    you can see my reasoning on reference count and I dont really see anything wrong with it, do you?

    Yes. You assert:

    6. D goes out of scope, reference count for D drops to 0 and D is extinguished

    I showed that what actually happens is more like:

    6. D goes out of scope. Nothing happens.
    N. (Much later) Global destruction finally fires and a bunch of stuff finally gets destroyed, forcibly breaking the circular references

    my fix does indeed prevent a bunch of stuff from being cleaned up until Perl's "global destruction". which is fine with me. [emphasis added]

    So you don't care about making circular references? The consequence of making circular references is that destructors don't fire until global destruction. You don't appear to understand that.

    Some reasons why I don't find acceptable the delaying of destruction until global destruction (and thus circular references) include:

    During global destruction, proper order of destruction is not enforced, which can lead to an object being destroyed after an object that it depends on has already been destroyed. This can produce obnoxious warnings, increase the complexity of destruction code, or just make proper clean-up not reliably possible.

    It also means that a long-running process that ends up making multiple connections to a database (for example) will "leak memory" or even leak other resources (like hording open file handles).

    It can also delay or even prevent the flushing of data. It can also delay the detection and reporting of bugs like a user forgetting to "finish" some operation. In some environments, delaying such reporting until global destruction can easily effectively make such reporting useless.

    Did you demonstrate that my patch creates circular references?

    Do you have some alternate theory as to why destruction gets delayed until global destruction? The simple, obvious explanation is that the extra reference that your "fix" creates produces a cycle. I didn't provide detailed documentation of the exact nature of the cycle, but stuff not getting destroyed when everything related to it has gone out of scope is pretty convincing evidence of the cycle existing in this case.

    Are you implying that my method chaining and the resulting destruction was unsound?

    Rather than implying it, I thought I stated it quite explicitly:

    you should simply stop writing code that destroys the container object if you want to keep using one of the contained objects

    Yes, it is "unsound" to make the controller object a temporary throw-away that does not live long enough for you to finish using the subordinate object that you got from it (if the subordinate object's life cycle is supposed to be limited to within the controller's life cycle, as is the case here).

    - tye        

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://923464]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2014-10-20 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (74 votes), past polls