Greeting everyone, i get stucked using modperl2 on apache 2.4 (mpm_event) and ubuntu (upgraded on daily base form ubuntu-repo). I try to keep some filehandles and datastructures simply on a "our" variable. This works fine until i generate some network load for this server (1000 persistent connections each wants to get the same stuff). Than it looks like the "our" is forgeting its value. This is happening much faster if you are using more threads per child. Here a simple example:

package example::PerlResponseHandler; use strict; use warnings; use APR::OS (); use Apache2::Const -compile => qw(OK); our $obj; sub handler { my $r = shift; my $tid = APR::OS::current_thread_id(); if(!$obj) { $obj = {one => 1}; warn "[pid $$ tid $tid] New object generated"; } $r->content_type('text/html'); $r->print('mod_perl rules!' . $obj->{one}); return Apache2::Const::OK; } 1;

Using this package as responsehandler in your apache2.conf and the `ab`-tool targeting this handler, you will see at your error.log that the our var is getting setted. After some time you will see that this variable is reseted on and on.

Using 5000 MaxRequestWorkers splitted by threads 250 on each child i could see that only 18 threads was able to hold this variable without any interaction after it was initialized (over days!).

Even if i used only 3 threads per child and 1500 possible servers, the error was reproduced after the 264 thread was spawned. 263 threads was keeping their states over days.

The server have enough ressources over and no limits being reached.

I want to achive that all my threads holding the states of their our vars.

After some sleepless days i decided to ask the perlmonk community. Hopefully somebody can help further.


In reply to Modperl2 + mpm_event + seemingly forgotten global vars by spellila

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.