Segfault when connecting during Apache startup with Apache::DBI - modperl

This is a discussion on Segfault when connecting during Apache startup with Apache::DBI - modperl ; On Tue, Jul 1, 2008 at 3:42 AM, Tobias Kremer wrote: > Removing Apache: BI makes the errors go away. Ok. First, check that you're on the latest version. Then, turn on the debug flag and see if it thinks ...

+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 29 of 29

Thread: Segfault when connecting during Apache startup with Apache::DBI

  1. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    On Tue, Jul 1, 2008 at 3:42 AM, Tobias Kremer wrote:
    > Removing Apache:BI makes the errors go away.


    Ok. First, check that you're on the latest version. Then, turn on
    the debug flag and see if it thinks it is reusing the startup
    connection or not.

    - Perrin


  2. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    On Tue, Jul 1, 2008 at 9:56 AM, Tobias Kremer wrote:
    > Yes, I'm using the latest 1.07 release. I already had the debug flag on and it's
    > correctly telling me that it's "skipping connection during server startup".


    Yes, but what does it tell you on the first connection AFTER startup?
    It should say whether it's making a new connection or not.

    - Perrin


  3. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    Quoting Perrin Harkins :
    > Ok. First, check that you're on the latest version. Then, turn on
    > the debug flag and see if it thinks it is reusing the startup
    > connection or not.


    Yes, I'm using the latest 1.07 release. I already had the debug flag on and it's
    correctly telling me that it's "skipping connection during server startup".

    --Tobias


  4. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    Quoting Perrin Harkins :
    > Yes, but what does it tell you on the first connection AFTER startup?
    > It should say whether it's making a new connection or not.


    Here's the complete debug output which suggests that the connection during
    startup is reused for the first request.

    On server start:
    ----------------
    20097 Apache:BI skipping connection during server startup, read the docu !!
    20097 Apache:BI push PerlCleanupHandler
    20097 Apache:BI need ping: yes
    20097 Apache:BI new connect to 'foo:bar...'
    20097 Apache:BI disconnect (overloaded)

    On first request:
    ----------------
    20099 Apache:BI need ping: yes
    20099 Apache:BI already connected to 'foo:bar...'
    20099 Apache:BI PerlCleanupHandler

    --Tobias


  5. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    On Tue, Jul 1, 2008 at 10:08 AM, Tobias Kremer wrote:
    > On server start:
    > ----------------
    > 20097 Apache:BI skipping connection during server startup, read the docu !!
    > 20097 Apache:BI push PerlCleanupHandler
    > 20097 Apache:BI need ping: yes
    > 20097 Apache:BI new connect to 'foo:bar...'
    > 20097 Apache:BI disconnect (overloaded)


    That looks like two different connect attempts. The line following
    the "skipping" part is a return, and then it must come back in later.

    How are you loading this? With a PerlModule call? Can you try
    loading it from a Perl section like this?


    use MyModule;


    - Perrin


  6. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    Quoting Perrin Harkins :
    > How are you loading this? With a PerlModule call? Can you try
    > loading it from a Perl section like this?
    >
    > use MyModule;
    >


    Wow, it seems that this fixes the problem! At least with my minimal application.

    Here's the debug output which looks quite promising IMHO:

    On server start:
    ----------------
    8816 Apache:BI skipping connection during server startup, read the docu !!
    [rest is gone!]

    On first request:
    -----------------
    8818 Apache:BI push PerlCleanupHandler
    8818 Apache:BI need ping: yes
    8818 Apache:BI new connect to 'foo:bar'
    8818 Apache:BI PerlCleanupHandler

    This comes up a couple of times for every new process and afterwards
    changes to "already connected" which is exactly the behaviour I expected in the
    first place.

    Do you have any idea what is going on? I'll check out how our real system
    behaves with this change.

    Thanks a lot, Perrin!

    --Tobias


  7. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    Quoting Tobias Kremer :
    > Quoting Perrin Harkins :
    > > How are you loading this? With a PerlModule call? Can you try
    > > loading it from a Perl section like this?
    > >
    > > use MyModule;
    > >

    > Wow, it seems that this fixes the problem!
    > Do you have any idea what is going on? I'll check out how our real system
    > behaves with this change.


    No more errors there either!

    I don't know anything about the internals but to me the mod_perl source looks
    like PerlModule is using "require" instead of "use" to load modules. I guess
    that is making the difference?

    Whatever the cause is, I think it should be documented somewhere. I'd happily
    provide a doc-patch for whatever documentation is suitable

    --Tobias


  8. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    On Wed, Jul 2, 2008 at 5:12 AM, Tobias Kremer wrote:
    > No more errors there either!


    Great!

    > I don't know anything about the internals but to me the mod_perl source looks
    > like PerlModule is using "require" instead of "use" to load modules. I guess
    > that is making the difference?


    I don't know the details, but there is something about the way
    PerlModule works in mod_perl 1 that causes it to load the module again
    when apache restarts at startup (it runs yours conf file twice when
    you start, as documented). Using an explicit use() puts an entry in
    %INC and fixes the issue. This should happen with require() as well,
    so I don't know what the problem is, but I've been told that mod_perl
    2 doesn't have this problem.

    There seems to be an additional bug in either Apache:BI or mod_perl
    1, since $Apache::ServerStarting == 1 seems not to be true the second
    time through. Can you have your Perl section print out the values of
    $Apache::ServerStarting and $Apache::ServerReStarting?

    - Perrin


  9. Re: Lost connection to MySQL server during query (was "Segfault when connecting during Apache startup")

    > I don't know the details, but there is something about the way
    > PerlModule works in mod_perl 1 that causes it to load the module again
    > when apache restarts at startup (it runs yours conf file twice when
    > you start, as documented). Using an explicit use() puts an entry in
    > %INC and fixes the issue. This should happen with require() as well,
    > so I don't know what the problem is, but I've been told that mod_perl
    > 2 doesn't have this problem.


    So, due to this being the mod_perl list there must be somebody here who knows
    what's going on deep down in the guts of the beast

    > There seems to be an additional bug in either Apache:BI or mod_perl
    > 1, since $Apache::ServerStarting == 1 seems not to be true the second
    > time through. Can you have your Perl section print out the values of
    > $Apache::ServerStarting and $Apache::ServerReStarting?


    This gives me:

    Apache::ServerStarting = 1
    Apache::ServerReStarting = 0

    once(!) on server startup - no matter if I "use" my handler or load it via
    PerlModule.

    --Tobias


+ Reply to Thread
Page 2 of 2 FirstFirst 1 2