Re: Upgrade to Debian stretch (stable) breaks my unique token

John Dunlap <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC5eUSsKF2tEQZDbc5s2G6wUT7Mc1V=x+0AwGRaxiqWGtL5SWw@mail.gmail.com>
Have you tried this in your Apache config?
PerlChildInitHandler "sub { srand }"

Citation:
http://blogs.perl.org/users/brian_phillips/2010/06/when-rand-isnt-random.html

On Thu, Mar 1, 2018 at 1:55 PM, Vincent Veyron <[email protected]> wrote:

> Hi all,
>
> I'm using the code below in a PerlResponseHandler; it generates a unique
> token for the request, if _token_id is not already present in the request's
> arguments. It's been working for months, and broke after my upgrade to
> stretch a week ago. I added a couple Data::Dumper calls to see what is
> going on;
>
> As you can see, _token_id is being reused across different requests, and
> across different apache children, even though it's absent from the
> request's arguments.
>
> To add insult to injury, this is happening on my production machine
> (kimsufi server) but not on the backup server (online)
>
> Any idea what might cause this?
>
>
> Code :
>
> $content .= edit_entry( $r, \%args ) ;
>
> sub edit_entry {
>
>     my ( $r, $args ) = @_ ;
>
>     use Data::Dumper;
>     warn Dumper($args);
>
>     $args->{_token_id} ||= join "", map +(0..9,"a".."z","A".."Z")[rand(10+26*2)],
> 1..32 ;
>
>     warn '_token_id -> ' . $args->{_token_id} ;
>     warn 'pid -> ' . $$;
>
> ....
>
> }
>
>
> Logs :
>
> $VAR1 = {
>           'mois' => '02',
>           'id_entry' => '17734',
>           'open_journal' => 'Fournisseurs'
>         };
> _token_id -> DzM5x0uvFcykvtGXEkhgeqhp5ZD48jLn at
> /home/lib/Compta/Base/Handler/entry.pm line 164.
> pid -> 21313 at /home/lib/Compta/Base/Handler/entry.pm line 165.
> $VAR1 = {
>           'mois' => '02',
>           'id_entry' => '17734',
>           'open_journal' => 'Fournisseurs'
>         };
> _token_id -> DzM5x0uvFcykvtGXEkhgeqhp5ZD48jLn at
> /home/lib/Compta/Base/Handler/entry.pm line 164.
> pid -> 21314 at /home/lib/Compta/Base/Handler/entry.pm line 165.
>
>
>
> Installation:
>
> # dpkg -l apache2*
> Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
> | État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/
> H=semi-installé/W=attend-traitement-déclenchements
> |/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
> ||/ Nom                      Version           Architecture
> Description
> +++-========================-=================-=============
> ====-======================================================
> ii  apache2                  2.4.25-3+deb9u3   amd64             Apache
> HTTP Server
> un  apache2-api-20120211     <aucune>          <aucune>          (aucune
> description n'est disponible)
> ii  apache2-bin              2.4.25-3+deb9u3   amd64             Apache
> HTTP Server (modules and other binary files)
> ii  apache2-data             2.4.25-3+deb9u3   all               Apache
> HTTP Server (common files)
> un  apache2-doc              <aucune>          <aucune>          (aucune
> description n'est disponible)
> un  apache2-suexec-custom    <aucune>          <aucune>          (aucune
> description n'est disponible)
> un  apache2-suexec-pristine  <aucune>          <aucune>          (aucune
> description n'est disponible)
> ii  apache2-utils            2.4.25-3+deb9u3   amd64             Apache
> HTTP Server (utility programs for web servers)
> un  apache2.2-bin            <aucune>          <aucune>          (aucune
> description n'est disponible)
> un  apache2.2-common         <aucune>          <aucune>          (aucune
> description n'est disponible)
>
> # dpkg -l libapach*
> Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
> | État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/
> H=semi-installé/W=attend-traitement-déclenchements
> |/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
> ||/ Nom                      Version           Architecture
> Description
> +++-========================-=================-=============
> ====-======================================================
> ii  libapache-dbi-perl       1.12-1            all               interface
> connecting apache server to database via per
> un  libapache-mod-perl       <aucune>          <aucune>          (aucune
> description n'est disponible)
> ii  libapache-session-perl   1.93-2            all               modules
> for keeping persistent user data across HTTP r
> ii  libapache2-mod-apreq2    2.13-5+b1         amd64             generic
> Apache request library - Apache module
> un  libapache2-mod-passenger <aucune>          <aucune>          (aucune
> description n'est disponible)
> ii  libapache2-mod-perl2     2.0.10-2          amd64
>  Integration of perl with the Apache2 web server
> un  libapache2-reload-perl   <aucune>          <aucune>          (aucune
> description n'est disponible)
> ii  libapache2-request-perl  2.13-5+b1         amd64             generic
> Apache request library - Perl modules
> root@kimsufi_1:/home/vincent#
>
>
>
>
>
> --
>                                         Bien à vous, Vincent Veyron
>
> https://marica.fr/
> Logiciel de gestion des sinistres assurances, des dossiers contentieux et
> des contrats pour le service juridique
>



-- 
John Dunlap
*CTO | Lariat *

*Direct:*
*[email protected] <[email protected]>*

*Customer Service:*
877.268.6667
[email protected]
100x60.png (image/png, 2.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.