FAQ
I've got a weird problem that I haven't been able to fix...

This behaviour exhibits on the 2 boxes I have that have Apache 1.3.14, ModPerl 1.24 (compiled in).

One is Solaris 2.6, one is 7.

Both run Embperl 1.3.0 (upgraded to 1.3.1 also and that had no effect)

Here's the problem I am running into.

If I have more than one VirtualHost setup to use Embperl sessions, randomly the session data for one site will be lost, and then a new cookie will be set (proper name, etc) but to the OTHER VIRTUAL HOSTS's Session table!

Each session table is on a different database (one database per VirtualHost in these examples)

I have enabled the DEBUG to look at the ENV, and for each request, the environment is set properly (ie if I go to clients.domain.com I see the SESSION_ARGS I set for that VirtualHost in the log, and also if I print it out from my Embperl processed page)

I've tried putting the PerlSetEnv settings in just the <VirtualHost> tags, moved Directory in/out of VirtualHost...same problem.

The first connection works fine, say if I got to clients.domain.com, I see the correct session ID in their database.

If I go to other.domain.com, I see the correct session cookie in their database/table.

But then, if I randomly use other browsers or machines, or the browsers I already have open, the ID will change.

And if I look in the MySQL logs, it is apparently as to _why_ this is happening, the connection ID making the updates that is being used to check for and set the session ID, is the wrong one for the site.

For example, MySQL processes:

+-----+------------+--------------+-------------+---------+------+-------+------------------+
Id | User | Host | db | Command | Time | State | Info |
+-----+------------+--------------+-------------+---------+------+-------+------------------+
401 | username | localhost | database | Sleep | 1228 | | |
402 | username2 | localhost | database2 | Sleep | 1205 | | |
401 should be used for "clients.domain.com". 402 should be used for "other.domain.com"

Let's pretend I go to clients.domain.com, and then the cookie "changes". If I look in the MySQL log I see it attempting to check via the wrong connection (in this case connection ID 402) instead of 401...and then of course it simply writes a new cookie...but of course I've lost all my session data.

Using Semaphore and removing the LockDataSource segements of EMBPERL_SESSION_ARGS didn't solve the problem.

It's like ModPerl, Embperl or Apache::Session is simply using the wrong connection, despite me setting SESSION_ARGS specific to each VirtualHost/Directory.

Any ideas?:)

httpd.conf:

<VirtualHost 192.168.1.11>
DocumentRoot /disk1/www/Clients
ServerName clients.domain.com
<Directory "/disk1/www/Clients">
<Files *.epl>
SetHandler perl-script
PerlHandler HTML::Embperl
Options +ExecCGI
PerlSetEnv EMBPERL_OPTIONS 16
PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain.com"
PerlSetEnv EMBPERL_COOKIE_PATH "/"
PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password"
</Files>
</Directory>
</VirtualHost>

<VirtualHost 192.168.1.11>
DocumentRoot /disk1/www/Other
ServerName other.domain2.com
<Directory "/disk1/www/Other">
<Files *.html>
SetHandler perl-script
PerlHandler HTML::Embperl
Options +ExecCGI
PerlSetEnv EMBPERL_OPTIONS 16
PerlSetEnv EMBPERL_COOKIE_PATH "/"
PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain2.com"
PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database2 UserName=username2 Password=password2 LockDataSource=dbi:mysql:database2 LockUserName=username2 LockPassword=password2"
</Files>
</Directory>
</VirtualHost>


Thanks!

Bill



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org

Search Discussions

  • goEbusiness.com at Mar 16, 2001 at 7:24 pm
    I should also mention this behavior happens if Apache::DBI (for persistance connections) is running or not.

    Bill
    On Fri, 16 Mar 2001, goEbusiness.com Mail Lists wrote:

    I've got a weird problem that I haven't been able to fix...

    This behaviour exhibits on the 2 boxes I have that have Apache 1.3.14, ModPerl 1.24 (compiled in).

    One is Solaris 2.6, one is 7.

    Both run Embperl 1.3.0 (upgraded to 1.3.1 also and that had no effect)

    Here's the problem I am running into.

    If I have more than one VirtualHost setup to use Embperl sessions, randomly the session data for one site will be lost, and then a new cookie will be set (proper name, etc) but to the OTHER VIRTUAL HOSTS's Session table!

    Each session table is on a different database (one database per VirtualHost in these examples)

    I have enabled the DEBUG to look at the ENV, and for each request, the environment is set properly (ie if I go to clients.domain.com I see the SESSION_ARGS I set for that VirtualHost in the log, and also if I print it out from my Embperl processed page)

    I've tried putting the PerlSetEnv settings in just the <VirtualHost> tags, moved Directory in/out of VirtualHost...same problem.

    The first connection works fine, say if I got to clients.domain.com, I see the correct session ID in their database.

    If I go to other.domain.com, I see the correct session cookie in their database/table.

    But then, if I randomly use other browsers or machines, or the browsers I already have open, the ID will change.

    And if I look in the MySQL logs, it is apparently as to _why_ this is happening, the connection ID making the updates that is being used to check for and set the session ID, is the wrong one for the site.

    For example, MySQL processes:

    +-----+------------+--------------+-------------+---------+------+-------+------------------+
    Id | User | Host | db | Command | Time | State | Info |
    +-----+------------+--------------+-------------+---------+------+-------+------------------+
    401 | username | localhost | database | Sleep | 1228 | | |
    402 | username2 | localhost | database2 | Sleep | 1205 | | |
    401 should be used for "clients.domain.com". 402 should be used for "other.domain.com"

    Let's pretend I go to clients.domain.com, and then the cookie "changes". If I look in the MySQL log I see it attempting to check via the wrong connection (in this case connection ID 402) instead of 401...and then of course it simply writes a new cookie...but of course I've lost all my session data.

    Using Semaphore and removing the LockDataSource segements of EMBPERL_SESSION_ARGS didn't solve the problem.

    It's like ModPerl, Embperl or Apache::Session is simply using the wrong connection, despite me setting SESSION_ARGS specific to each VirtualHost/Directory.

    Any ideas?:)

    httpd.conf:

    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Clients
    ServerName clients.domain.com
    <Directory "/disk1/www/Clients">
    <Files *.epl>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain.com"
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
    PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password"
    </Files>
    </Directory>
    </VirtualHost>

    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Other
    ServerName other.domain2.com
    <Directory "/disk1/www/Other">
    <Files *.html>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain2.com"
    PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
    PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database2 UserName=username2 Password=password2 LockDataSource=dbi:mysql:database2 LockUserName=username2 LockPassword=password2"
    </Files>
    </Directory>
    </VirtualHost>


    Thanks!

    Bill


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • ___cliff rayman___ at Mar 16, 2001 at 8:29 pm
    your example and your text do not match! see inline comments.

    "goEbusiness.com Mail Lists" wrote:
    If I have more than one VirtualHost setup to use Embperl sessions, randomly the session data for one site will be lost, and then a new cookie will be set (proper name, etc) but to the OTHER VIRTUAL HOSTS's Session table!

    Each session table is on a different database (one database per VirtualHost in these examples)

    I have enabled the DEBUG to look at the ENV, and for each request, the environment is set properly (ie if I go to clients.domain.com I see the SESSION_ARGS I set for that VirtualHost in the log, and also if I print it out from my Embperl processed page)

    I've tried putting the PerlSetEnv settings in just the <VirtualHost> tags, moved Directory in/out of VirtualHost...same problem.

    The first connection works fine, say if I got to clients.domain.com, I see the correct session ID in their database.

    If I go to other.domain.com, I see the correct session cookie in their database/table.
    if you use other.domain.com and clients.domain.com, then you are going to have a problem with a cookie
    domain of ".domain.com". the cookie from clients.domain.com will be offered to other.domain.com which of
    course has no record of it, and then delivers its own fresh cookie.

    But then, if I randomly use other browsers or machines, or the browsers I already have open, the ID will change.


    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Clients
    ServerName clients.domain.com
    <Directory "/disk1/www/Clients">
    <Files *.epl>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain.com"
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
    PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password"
    </Files>
    </Directory>
    </VirtualHost>

    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Other
    ServerName other.domain2.com
    <Directory "/disk1/www/Other">
    <Files *.html>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain2.com"
    this of course would work, because the COOKIE_DOMAIN is different. you need to
    examine the actual hostnames and the COOKE_DOMAIN values you have for each of
    them.

    hth,

    --
    ___cliff rayman___cliff@genwax.com___http://www.genwax.com/



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • goEbusiness.com at Mar 16, 2001 at 8:45 pm
    Sorry...made a typo :)

    Should be

    clients.domain.com

    and

    other.domain2.com

    So the line
    If I go to other.domain.com, I see the correct session cookie in their database/table.
    should read
    If I go to other.domain2.com, I see the correct session cookie in their database/table.
    I realize the cookies would overwrite themselves :) I made a typo.

    However, adding the COOKIE_DOMAIN value to set the cookies appart does set the cookies properly, however the sessions DB table is still written to incorrectly. In any case, it's a moot point cuz even if I don't have that, it's set to whatever I have set as the ServerName in the VirtualHost config.

    Bill
    On Fri, 16 Mar 2001, ___cliff rayman___ wrote:

    your example and your text do not match! see inline comments.

    "goEbusiness.com Mail Lists" wrote:
    If I have more than one VirtualHost setup to use Embperl sessions, randomly the session data for one site will be lost, and then a new cookie will be set (proper name, etc) but to the OTHER VIRTUAL HOSTS's Session table!

    Each session table is on a different database (one database per VirtualHost in these examples)

    I have enabled the DEBUG to look at the ENV, and for each request, the environment is set properly (ie if I go to clients.domain.com I see the SESSION_ARGS I set for that VirtualHost in the log, and also if I print it out from my Embperl processed page)

    I've tried putting the PerlSetEnv settings in just the <VirtualHost> tags, moved Directory in/out of VirtualHost...same problem.

    The first connection works fine, say if I got to clients.domain.com, I see the correct session ID in their database.

    If I go to other.domain.com, I see the correct session cookie in their database/table.
    if you use other.domain.com and clients.domain.com, then you are going to have a problem with a cookie
    domain of ".domain.com". the cookie from clients.domain.com will be offered to other.domain.com which of
    course has no record of it, and then delivers its own fresh cookie.

    But then, if I randomly use other browsers or machines, or the browsers I already have open, the ID will change.


    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Clients
    ServerName clients.domain.com
    <Directory "/disk1/www/Clients">
    <Files *.epl>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain.com"
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
    PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password"
    </Files>
    </Directory>
    </VirtualHost>

    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Other
    ServerName other.domain2.com
    <Directory "/disk1/www/Other">
    <Files *.html>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain2.com"
    this of course would work, because the COOKIE_DOMAIN is different. you need to
    examine the actual hostnames and the COOKE_DOMAIN values you have for each of
    them.

    hth,

    --
    ___cliff rayman___cliff@genwax.com___http://www.genwax.com/

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • goEbusiness.com at Mar 16, 2001 at 9:14 pm
    Another interesting find.

    I just went to clients.domain.com

    Refreshed a few times, access other.domain2.com, then went back to clients.domain.com and BAM...the session changed. The new ID that should be in the clients database, was actually in other.domain2.com's database.

    I had added EMBPERL_DEBUG 16 to each virtual and logged each virtual to a separate log file.

    So, I check the clients.domain.com log, and do not see the request in there.

    However, it is in the other.domain2.com log! It's really weird through, because key ENV settings show that I actually requested clients.domain.com....yet Apache or something interpreted it as other.domain2.com (or at least logged it in that Virtual's log file)...yet I got the proper HTML output from clients.domain.com.

    Here's the log, I went to clients.domain.com, yet it shows up in the log for other.domain2.com!!!

    [18479]ENV: EMBPERL_LOG=/tmp/embperlClients.log

    Yet it showed up in the embperlOther.log file!

    Could this possibly be a Apache/ModPerl problem?

    Here's the entire snapshot of that request:

    [18479]MEM: Load /disk1/www/Clients/index.epl in HTML::Embperl::DOC::_3
    [18479]CACHE: New File for '/disk1/www/Clients/index.epl' (4b6580) in 'HTML::Embperl::DOC::_3' hash cache-key '/disk1/www/Clients/index.epl'
    [18479]REQ: Embperl 1.3.1 starting... Fri Mar 16 16:15:59 2001
    [18479]REQ: No Safe Eval All Opcode allowed mode = mod_perl (3)
    [18479]REQ: Package = HTML::Embperl::DOC::_3
    [18479]ENV: EMBPERL_SESSION_CLASSES=MySQL MySQL
    [18479]ENV: QUERY_STRING=
    [18479]ENV: SERVER_ADDR=192.168.1.11
    [18479]ENV: HTTP_ACCEPT_LANGUAGE=en-us
    [18479]ENV: SERVER_PROTOCOL=HTTP/1.1
    [18479]ENV: TZ=US/Eastern
    [18479]ENV: HTTP_CONNECTION=Keep-Alive
    [18479]ENV: SERVER_SIGNATURE=<ADDRESS>Apache/1.3.14 Server at clients.domain.com Port 80</ADDRESS>

    [18479]ENV: PATH_TRANSLATED=/disk1/www/Clients/index.epl
    [18479]ENV: REMOTE_PORT=4949
    [18479]ENV: HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
    [18479]ENV: HTTP_ACCEPT=*/*
    [18479]ENV: HTTP_HOST=clients.domain.com
    [18479]ENV: GATEWAY_INTERFACE=CGI-Perl/1.1
    [18479]ENV: SERVER_SOFTWARE=Apache/1.3.14 (Unix) PHP/4.0.4pl1 mod_perl/1.24 mod_ssl/2.7.1 OpenSSL/0.9.6
    [18479]ENV: SERVER_ADMIN=root@amen-ra.domain.com
    [18479]ENV: REMOTE_ADDR=192.168.1.125
    [18479]ENV: EMBPERL_COOKIE_PATH=/
    [18479]ENV: SCRIPT_NAME=/index.epl
    [18479]ENV: SERVER_NAME=clients.domain.com
    [18479]ENV: HTTP_ACCEPT_ENCODING=gzip, deflate
    [18479]ENV: DOCUMENT_ROOT=/disk1/www/Clients
    [18479]ENV: EMBPERL_LOG=/tmp/embperlClients.log
    [18479]ENV: REQUEST_URI=/
    [18479]ENV: MOD_PERL=mod_perl/1.24
    [18479]ENV: EMBPERL_SESSION_ARGS=DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password
    [18479]ENV: REDIRECT_STATUS=200
    [18479]ENV: HTTP_COOKIE=EMBPERL_UID=7ef39459a818cb4f962a52b69546796e
    [18479]ENV: EMBPERL_COOKIE_DOMAIN=.domain.com
    [18479]ENV: REQUEST_METHOD=GET
    [18479]ENV: SCRIPT_FILENAME=/disk1/www/Clients/index.epl
    [18479]ENV: REDIRECT_URL=/
    [18479]ENV: EMBPERL_OPTIONS=16
    [18479]ENV: EMBPERL_DEBUG=16
    [18479]ENV: PATH=/:.:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/ccs/bin:/usr/local/perl/bin:/usr/local/mysql/bin:/usr/u
    cb
    [18479]ENV: SERVER_PORT=80
    [18479]Formdata... length = 0

    On Fri, 16 Mar 2001, goEbusiness.com Mail Lists wrote:

    Sorry...made a typo :)

    Should be

    clients.domain.com

    and

    other.domain2.com

    So the line
    If I go to other.domain.com, I see the correct session cookie in their database/table.
    should read
    If I go to other.domain2.com, I see the correct session cookie in their database/table.
    I realize the cookies would overwrite themselves :) I made a typo.

    However, adding the COOKIE_DOMAIN value to set the cookies appart does set the cookies properly, however the sessions DB table is still written to incorrectly. In any case, it's a moot point cuz even if I don't have that, it's set to whatever I have set as the ServerName in the VirtualHost config.

    Bill
    On Fri, 16 Mar 2001, ___cliff rayman___ wrote:

    your example and your text do not match! see inline comments.

    "goEbusiness.com Mail Lists" wrote:
    If I have more than one VirtualHost setup to use Embperl sessions, randomly the session data for one site will be lost, and then a new cookie will be set (proper name, etc) but to the OTHER VIRTUAL HOSTS's Session table!

    Each session table is on a different database (one database per VirtualHost in these examples)

    I have enabled the DEBUG to look at the ENV, and for each request, the environment is set properly (ie if I go to clients.domain.com I see the SESSION_ARGS I set for that VirtualHost in the log, and also if I print it out from my Embperl processed page)

    I've tried putting the PerlSetEnv settings in just the <VirtualHost> tags, moved Directory in/out of VirtualHost...same problem.

    The first connection works fine, say if I got to clients.domain.com, I see the correct session ID in their database.

    If I go to other.domain.com, I see the correct session cookie in their database/table.
    if you use other.domain.com and clients.domain.com, then you are going to have a problem with a cookie
    domain of ".domain.com". the cookie from clients.domain.com will be offered to other.domain.com which of
    course has no record of it, and then delivers its own fresh cookie.

    But then, if I randomly use other browsers or machines, or the browsers I already have open, the ID will change.


    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Clients
    ServerName clients.domain.com
    <Directory "/disk1/www/Clients">
    <Files *.epl>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain.com"
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
    PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password"
    </Files>
    </Directory>
    </VirtualHost>

    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Other
    ServerName other.domain2.com
    <Directory "/disk1/www/Other">
    <Files *.html>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain2.com"
    this of course would work, because the COOKIE_DOMAIN is different. you need to
    examine the actual hostnames and the COOKE_DOMAIN values you have for each of
    them.

    hth,

    --
    ___cliff rayman___cliff@genwax.com___http://www.genwax.com/

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • goEbusiness.com at Mar 16, 2001 at 11:08 pm
    Ok, I figured out what's happening....but not how to fix yet :)-

    Each of my web server processes seems to have a different EMBPERL_SESSION_ARG value...globally...in fact I think each Embperl Env I set is unique to each process.

    I added a print out of the pid ($$) to the bottom of each page, and each time the session ID changed, so did the PID.

    Then, checking the logs I see that the PID that I see on my screen (keep in mind I am getting the proper HTML output) is NOT in the log that corresponds to the site I requested...it's in the other site.

    So, I restarted apache and went to each site once...and recorded what PID was in each log...each log held a different PID...not one PID showed up in both logs!

    I then refreshed on "other.domain2.com" for awhile until the ID changed.

    Lo and behold I hit a PID that only showed up in the Clients log file! Yet the EMBPERL_SESSION_ARGS (and every other ENV output, and other Embperl debug output, like what file it processed, etc) is _correct_ for the site I wanted, yet the ID was written into the Client's database (and log). So it seems that the EMBPERL_SESSION_ARG is being ignore for the virtual for some reason...whatever the PID handled _first_ sticks...even though the debug output reflects the proper output.

    Now to figure out why that is! :)

    Bill
    On Fri, 16 Mar 2001, goEbusiness.com Mail Lists wrote:

    Another interesting find.

    I just went to clients.domain.com

    Refreshed a few times, access other.domain2.com, then went back to clients.domain.com and BAM...the session changed. The new ID that should be in the clients database, was actually in other.domain2.com's database.

    I had added EMBPERL_DEBUG 16 to each virtual and logged each virtual to a separate log file.

    So, I check the clients.domain.com log, and do not see the request in there.

    However, it is in the other.domain2.com log! It's really weird through, because key ENV settings show that I actually requested clients.domain.com....yet Apache or something interpreted it as other.domain2.com (or at least logged it in that Virtual's log file)...yet I got the proper HTML output from clients.domain.com.

    Here's the log, I went to clients.domain.com, yet it shows up in the log for other.domain2.com!!!

    [18479]ENV: EMBPERL_LOG=/tmp/embperlClients.log

    Yet it showed up in the embperlOther.log file!

    Could this possibly be a Apache/ModPerl problem?

    Here's the entire snapshot of that request:

    [18479]MEM: Load /disk1/www/Clients/index.epl in HTML::Embperl::DOC::_3
    [18479]CACHE: New File for '/disk1/www/Clients/index.epl' (4b6580) in 'HTML::Embperl::DOC::_3' hash cache-key '/disk1/www/Clients/index.epl'
    [18479]REQ: Embperl 1.3.1 starting... Fri Mar 16 16:15:59 2001
    [18479]REQ: No Safe Eval All Opcode allowed mode = mod_perl (3)
    [18479]REQ: Package = HTML::Embperl::DOC::_3
    [18479]ENV: EMBPERL_SESSION_CLASSES=MySQL MySQL
    [18479]ENV: QUERY_STRING=
    [18479]ENV: SERVER_ADDR=192.168.1.11
    [18479]ENV: HTTP_ACCEPT_LANGUAGE=en-us
    [18479]ENV: SERVER_PROTOCOL=HTTP/1.1
    [18479]ENV: TZ=US/Eastern
    [18479]ENV: HTTP_CONNECTION=Keep-Alive
    [18479]ENV: SERVER_SIGNATURE=<ADDRESS>Apache/1.3.14 Server at clients.domain.com Port 80</ADDRESS>

    [18479]ENV: PATH_TRANSLATED=/disk1/www/Clients/index.epl
    [18479]ENV: REMOTE_PORT=4949
    [18479]ENV: HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
    [18479]ENV: HTTP_ACCEPT=*/*
    [18479]ENV: HTTP_HOST=clients.domain.com
    [18479]ENV: GATEWAY_INTERFACE=CGI-Perl/1.1
    [18479]ENV: SERVER_SOFTWARE=Apache/1.3.14 (Unix) PHP/4.0.4pl1 mod_perl/1.24 mod_ssl/2.7.1 OpenSSL/0.9.6
    [18479]ENV: SERVER_ADMIN=root@amen-ra.domain.com
    [18479]ENV: REMOTE_ADDR=192.168.1.125
    [18479]ENV: EMBPERL_COOKIE_PATH=/
    [18479]ENV: SCRIPT_NAME=/index.epl
    [18479]ENV: SERVER_NAME=clients.domain.com
    [18479]ENV: HTTP_ACCEPT_ENCODING=gzip, deflate
    [18479]ENV: DOCUMENT_ROOT=/disk1/www/Clients
    [18479]ENV: EMBPERL_LOG=/tmp/embperlClients.log
    [18479]ENV: REQUEST_URI=/
    [18479]ENV: MOD_PERL=mod_perl/1.24
    [18479]ENV: EMBPERL_SESSION_ARGS=DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password
    [18479]ENV: REDIRECT_STATUS=200
    [18479]ENV: HTTP_COOKIE=EMBPERL_UID=7ef39459a818cb4f962a52b69546796e
    [18479]ENV: EMBPERL_COOKIE_DOMAIN=.domain.com
    [18479]ENV: REQUEST_METHOD=GET
    [18479]ENV: SCRIPT_FILENAME=/disk1/www/Clients/index.epl
    [18479]ENV: REDIRECT_URL=/
    [18479]ENV: EMBPERL_OPTIONS=16
    [18479]ENV: EMBPERL_DEBUG=16
    [18479]ENV: PATH=/:.:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/ccs/bin:/usr/local/perl/bin:/usr/local/mysql/bin:/usr/u
    cb
    [18479]ENV: SERVER_PORT=80
    [18479]Formdata... length = 0

    On Fri, 16 Mar 2001, goEbusiness.com Mail Lists wrote:

    Sorry...made a typo :)

    Should be

    clients.domain.com

    and

    other.domain2.com

    So the line
    If I go to other.domain.com, I see the correct session cookie in their database/table.
    should read
    If I go to other.domain2.com, I see the correct session cookie in their database/table.
    I realize the cookies would overwrite themselves :) I made a typo.

    However, adding the COOKIE_DOMAIN value to set the cookies appart does set the cookies properly, however the sessions DB table is still written to incorrectly. In any case, it's a moot point cuz even if I don't have that, it's set to whatever I have set as the ServerName in the VirtualHost config.

    Bill
    On Fri, 16 Mar 2001, ___cliff rayman___ wrote:

    your example and your text do not match! see inline comments.

    "goEbusiness.com Mail Lists" wrote:
    If I have more than one VirtualHost setup to use Embperl sessions, randomly the session data for one site will be lost, and then a new cookie will be set (proper name, etc) but to the OTHER VIRTUAL HOSTS's Session table!

    Each session table is on a different database (one database per VirtualHost in these examples)

    I have enabled the DEBUG to look at the ENV, and for each request, the environment is set properly (ie if I go to clients.domain.com I see the SESSION_ARGS I set for that VirtualHost in the log, and also if I print it out from my Embperl processed page)

    I've tried putting the PerlSetEnv settings in just the <VirtualHost> tags, moved Directory in/out of VirtualHost...same problem.

    The first connection works fine, say if I got to clients.domain.com, I see the correct session ID in their database.

    If I go to other.domain.com, I see the correct session cookie in their database/table.
    if you use other.domain.com and clients.domain.com, then you are going to have a problem with a cookie
    domain of ".domain.com". the cookie from clients.domain.com will be offered to other.domain.com which of
    course has no record of it, and then delivers its own fresh cookie.

    But then, if I randomly use other browsers or machines, or the browsers I already have open, the ID will change.


    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Clients
    ServerName clients.domain.com
    <Directory "/disk1/www/Clients">
    <Files *.epl>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain.com"
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL MySQL"
    PerlSetEnv EMBPERL_SESSION_ARGS "DataSource=dbi:mysql:database UserName=username Password=password LockDataSource=dbi:mysql:database LockUserName=username LockPassword=password"
    </Files>
    </Directory>
    </VirtualHost>

    <VirtualHost 192.168.1.11>
    DocumentRoot /disk1/www/Other
    ServerName other.domain2.com
    <Directory "/disk1/www/Other">
    <Files *.html>
    SetHandler perl-script
    PerlHandler HTML::Embperl
    Options +ExecCGI
    PerlSetEnv EMBPERL_OPTIONS 16
    PerlSetEnv EMBPERL_COOKIE_PATH "/"
    PerlSetEnv EMBPERL_COOKIE_DOMAIN ".domain2.com"
    this of course would work, because the COOKIE_DOMAIN is different. you need to
    examine the actual hostnames and the COOKE_DOMAIN values you have for each of
    them.

    hth,

    --
    ___cliff rayman___cliff@genwax.com___http://www.genwax.com/

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • ___cliff rayman___ at Mar 16, 2001 at 11:16 pm
    sounds to be like the EMBPERL_SESSION_ARGS are stored in global variables
    that are initialized either at child init time or the first time a request is made for that child,
    and are not reloaded on each execution of the request.

    not sure if it is in the docs, but obviously one session store interface was assumed for each
    apache/perl child. you'll have to look at the source to see if that behavior is changeable.

    "goEbusiness.com Mail Lists" wrote:
    Ok, I figured out what's happening....but not how to fix yet :)-

    Each of my web server processes seems to have a different EMBPERL_SESSION_ARG value...globally...in fact I think each Embperl Env I set is unique to each process.

    I added a print out of the pid ($$) to the bottom of each page, and each time the session ID changed, so did the PID.

    Then, checking the logs I see that the PID that I see on my screen (keep in mind I am getting the proper HTML output) is NOT in the log that corresponds to the site I requested...it's in the other site.

    So, I restarted apache and went to each site once...and recorded what PID was in each log...each log held a different PID...not one PID showed up in both logs!

    I then refreshed on "other.domain2.com" for awhile until the ID changed.

    Lo and behold I hit a PID that only showed up in the Clients log file! Yet the EMBPERL_SESSION_ARGS (and every other ENV output, and other Embperl debug output, like what file it processed, etc) is _correct_ for the site I wanted, yet the ID was written into the Client's database (and log). So it seems that the EMBPERL_SESSION_ARG is being ignore for the virtual for some reason...whatever the PID handled _first_ sticks...even though the debug output reflects the proper output.

    Now to figure out why that is! :)

    Bill



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Joseph Jeremy Lauer at Mar 16, 2001 at 11:25 pm
    Has anyone noticed that sessions are the number one problem in every post to
    this list?

    I know that sessions were my biggest problem with Embperl. I don't care
    what anyone has to say -- they are more difficult to setup than they should
    be.

    Maybe someone who knows them in and out can write a White Paper on the
    subject? Describe the differences between locks, storage methods,
    differences between operating systems. What works and what doesn't?
    Versions of Apache::Session that work together?

    I bet this would cut down Gerald's work of answering this mailing list.

    My thoughts,
    Joe

    -----Original Message-----
    From: ___cliff rayman___
    Sent: Friday, March 16, 2001 6:22 PM
    To: goEbusiness.com Mail Lists
    Cc: embperl@perl.apache.org
    Subject: Re: Sessions, MySQL, Embperl, ModPerl, more than VirtualHost
    =Problem!


    sounds to be like the EMBPERL_SESSION_ARGS are stored in global variables
    that are initialized either at child init time or the first time a request
    is made for that child,
    and are not reloaded on each execution of the request.

    not sure if it is in the docs, but obviously one session store interface was
    assumed for each
    apache/perl child. you'll have to look at the source to see if that
    behavior is changeable.

    "goEbusiness.com Mail Lists" wrote:
    Ok, I figured out what's happening....but not how to fix yet :)-

    Each of my web server processes seems to have a different
    EMBPERL_SESSION_ARG value...globally...in fact I think each Embperl Env I
    set is unique to each process.
    I added a print out of the pid ($$) to the bottom of each page, and each
    time the session ID changed, so did the PID.
    Then, checking the logs I see that the PID that I see on my screen (keep
    in mind I am getting the proper HTML output) is NOT in the log that
    corresponds to the site I requested...it's in the other site.
    So, I restarted apache and went to each site once...and recorded what PID
    was in each log...each log held a different PID...not one PID showed up in
    both logs!
    I then refreshed on "other.domain2.com" for awhile until the ID changed.

    Lo and behold I hit a PID that only showed up in the Clients log file!
    Yet the EMBPERL_SESSION_ARGS (and every other ENV output, and other Embperl
    debug output, like what file it processed, etc) is _correct_ for the site I
    wanted, yet the ID was written into the Client's database (and log). So it
    seems that the EMBPERL_SESSION_ARG is being ignore for the virtual for some
    reason...whatever the PID handled _first_ sticks...even though the debug
    output reflects the proper output.
    Now to figure out why that is! :)

    Bill



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Mar 17, 2001 at 1:58 pm

    Has anyone noticed that sessions are the number one problem in every post to
    this list?

    I know that sessions were my biggest problem with Embperl. I don't care
    what anyone has to say -- they are more difficult to setup than they should
    be.

    Maybe someone who knows them in and out can write a White Paper on the
    subject? Describe the differences between locks, storage methods,
    differences between operating systems. What works and what doesn't?
    Versions of Apache::Session that work together?
    I would highly appreciate if anybody could write something about session
    setup. That's really a topic that must be explained in detail. I currently
    don't have the time to do it own my own, but I would support anybody who is
    willing to do so

    Gerald

    I bet this would cut down Gerald's work of answering this mailing list.

    My thoughts,
    Joe

    -----Original Message-----
    From: ___cliff rayman___
    Sent: Friday, March 16, 2001 6:22 PM
    To: goEbusiness.com Mail Lists
    Cc: embperl@perl.apache.org
    Subject: Re: Sessions, MySQL, Embperl, ModPerl, more than VirtualHost
    =Problem!


    sounds to be like the EMBPERL_SESSION_ARGS are stored in global variables
    that are initialized either at child init time or the first time a request
    is made for that child,
    and are not reloaded on each execution of the request.

    not sure if it is in the docs, but obviously one session store interface was
    assumed for each
    apache/perl child. you'll have to look at the source to see if that
    behavior is changeable.

    "goEbusiness.com Mail Lists" wrote:
    Ok, I figured out what's happening....but not how to fix yet :)-

    Each of my web server processes seems to have a different
    EMBPERL_SESSION_ARG value...globally...in fact I think each Embperl Env I
    set is unique to each process.
    I added a print out of the pid ($$) to the bottom of each page, and each
    time the session ID changed, so did the PID.
    Then, checking the logs I see that the PID that I see on my screen (keep
    in mind I am getting the proper HTML output) is NOT in the log that
    corresponds to the site I requested...it's in the other site.
    So, I restarted apache and went to each site once...and recorded what
    PID
    was in each log...each log held a different PID...not one PID showed up in
    both logs!
    I then refreshed on "other.domain2.com" for awhile until the ID changed.

    Lo and behold I hit a PID that only showed up in the Clients log file!
    Yet the EMBPERL_SESSION_ARGS (and every other ENV output, and other Embperl
    debug output, like what file it processed, etc) is _correct_ for the site I
    wanted, yet the ID was written into the Client's database (and log). So it
    seems that the EMBPERL_SESSION_ARG is being ignore for the virtual for some
    reason...whatever the PID handled _first_ sticks...even though the debug
    output reflects the proper output.
    Now to figure out why that is! :)

    Bill



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org


    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org


    -------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    Internetconnect * Webserver/-design/-datenbanken * Consulting

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 925131
    WWW: http://www.ecos.de Fax: +49 6133 925152
    -------------------------------------------------------------



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • Gerald Richter at Mar 17, 2001 at 1:55 pm

    sounds to be like the EMBPERL_SESSION_ARGS are stored in global variables
    that are initialized either at child init time or the first time a request
    is made for that child,
    and are not reloaded on each execution of the request.
    EMBPERL_SESSION_CLASSES and EMBPERL_SESSION_ARGS are global, they cannot
    differ between virtual hosts. This is done for performance reasons. The
    session setup is done only once at startup time, to speed up the actual
    request.

    To make sure that you have different session for different virtual host,
    just change the cookie name.

    PerlSetEnv EMBPERL_COOKIE_NAME epsess1


    PerlSetEnv EMBPERL_COOKIE_NAME epsess2


    Also now all sessions are stored in the same database,because of the
    different cookie names, they are not mixed up and every virtual host has
    it's own %udat, also for the same user.

    Hope this helps

    Gerald

    not sure if it is in the docs, but obviously one session store interface
    was assumed for each
    apache/perl child. you'll have to look at the source to see if that
    behavior is changeable.
    "goEbusiness.com Mail Lists" wrote:
    Ok, I figured out what's happening....but not how to fix yet :)-

    Each of my web server processes seems to have a different
    EMBPERL_SESSION_ARG value...globally...in fact I think each Embperl Env I
    set is unique to each process.
    I added a print out of the pid ($$) to the bottom of each page, and each
    time the session ID changed, so did the PID.
    Then, checking the logs I see that the PID that I see on my screen (keep
    in mind I am getting the proper HTML output) is NOT in the log that
    corresponds to the site I requested...it's in the other site.
    So, I restarted apache and went to each site once...and recorded what
    PID was in each log...each log held a different PID...not one PID showed up
    in both logs!
    I then refreshed on "other.domain2.com" for awhile until the ID changed.

    Lo and behold I hit a PID that only showed up in the Clients log file!
    Yet the EMBPERL_SESSION_ARGS (and every other ENV output, and other Embperl
    debug output, like what file it processed, etc) is _correct_ for the site I
    wanted, yet the ID was written into the Client's database (and log). So it
    seems that the EMBPERL_SESSION_ARG is being ignore for the virtual for some
    reason...whatever the PID handled _first_ sticks...even though the debug
    output reflects the proper output.
    Now to figure out why that is! :)

    Bill



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org


    -------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    Internetconnect * Webserver/-design/-datenbanken * Consulting

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 925131
    WWW: http://www.ecos.de Fax: +49 6133 925152
    -------------------------------------------------------------




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org
  • goEbusiness.com at Mar 17, 2001 at 2:10 pm
    Yes, this helps...thanks!

    Bill
    On Sat, 17 Mar 2001, Gerald Richter wrote:

    sounds to be like the EMBPERL_SESSION_ARGS are stored in global variables
    that are initialized either at child init time or the first time a request
    is made for that child,
    and are not reloaded on each execution of the request.
    EMBPERL_SESSION_CLASSES and EMBPERL_SESSION_ARGS are global, they cannot
    differ between virtual hosts. This is done for performance reasons. The
    session setup is done only once at startup time, to speed up the actual
    request.

    To make sure that you have different session for different virtual host,
    just change the cookie name.

    PerlSetEnv EMBPERL_COOKIE_NAME epsess1


    PerlSetEnv EMBPERL_COOKIE_NAME epsess2


    Also now all sessions are stored in the same database,because of the
    different cookie names, they are not mixed up and every virtual host has
    it's own %udat, also for the same user.

    Hope this helps

    Gerald

    not sure if it is in the docs, but obviously one session store interface
    was assumed for each
    apache/perl child. you'll have to look at the source to see if that
    behavior is changeable.
    "goEbusiness.com Mail Lists" wrote:
    Ok, I figured out what's happening....but not how to fix yet :)-

    Each of my web server processes seems to have a different
    EMBPERL_SESSION_ARG value...globally...in fact I think each Embperl Env I
    set is unique to each process.
    I added a print out of the pid ($$) to the bottom of each page, and each
    time the session ID changed, so did the PID.
    Then, checking the logs I see that the PID that I see on my screen (keep
    in mind I am getting the proper HTML output) is NOT in the log that
    corresponds to the site I requested...it's in the other site.
    So, I restarted apache and went to each site once...and recorded what
    PID was in each log...each log held a different PID...not one PID showed up
    in both logs!
    I then refreshed on "other.domain2.com" for awhile until the ID changed.

    Lo and behold I hit a PID that only showed up in the Clients log file!
    Yet the EMBPERL_SESSION_ARGS (and every other ENV output, and other Embperl
    debug output, like what file it processed, etc) is _correct_ for the site I
    wanted, yet the ID was written into the Client's database (and log). So it
    seems that the EMBPERL_SESSION_ARG is being ignore for the virtual for some
    reason...whatever the PID handled _first_ sticks...even though the debug
    output reflects the proper output.
    Now to figure out why that is! :)

    Bill



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org


    -------------------------------------------------------------
    Gerald Richter ecos electronic communication services gmbh
    Internetconnect * Webserver/-design/-datenbanken * Consulting

    Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
    E-Mail: richter@ecos.de Voice: +49 6133 925131
    WWW: http://www.ecos.de Fax: +49 6133 925152
    -------------------------------------------------------------




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
    For additional commands, e-mail: embperl-help@perl.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupembperl @
categoriesmodperl, perl
postedMar 16, '01 at 7:01p
activeMar 17, '01 at 2:10p
posts11
users4
websiteperl.apache.org

People

Translate

site design / logo © 2022 Grokbase