in reply to Class::DBI and mod_perl 2

I believe the equivalent for threads is threads->tid. I didn't use it in either of these solutions because I don't use threads.

Replies are listed 'Best First'.
Re^2: Class::DBI and mod_perl 2
by meredith (Friar) on Jun 12, 2007 at 19:01 UTC

    Thanks for your work on this, perrin. One question - the only place I can find "private_cache_key_pid" is in this code snippet, where it is only assigned. Is this a custom attribute for DBI that is in a locally modified copy?

    I'm trying to use this in conjunction with Class::DBI, and when I paste this into my DBI class, instead of "fetch before execute" errors in the parent, I'm getting "server has gone away". I'm setting InactiveDestroy on all the children, but the best I can figure is that somewhere Class::DBI is breaking my connection in its own DESTROY handlers. I don't actually use DBI in the children, it's just that the fork behavior breaks the parent's connection.

    As you know, Ima::DBI creates closures and I likely have a ton of references to it in child "memory", so it's not as simple as setting InactiveDestroy and undefining a handle. =\

    mhoward - at - hattmoward.org

      Read the section in the DBI docs about connect_cached. It comes from there.

      By the way, I recently released a new version of Ima::DBI which includes this patch, but doesn't use threads->tid. If you can verify that threads->tid works for you, I could put it in the main Ima::DBI distribution so you wouldn't need to patch it.

        Ah, I see. It's just extra safety beyond the check for "$process_id == $$" right?

        Thanks for mentioning the update. I just bumped up from 0.34 and removed the snippet from my module. Unfortunately this does just cause the same behavior, but at least I got an update. ;) I think I'll have to use my own db_Main so I have control of the original dbh object somewhere.

        I'm not using threads, so I'll assume that is directed at the OP. :)

        mhoward - at - hattmoward.org