Session oddness/bug?

From: Date: Wed, 29 Mar 2000 04:37:43 +0000
Subject: Session oddness/bug?
Groups: php.version4 
Request: Send a blank email to php-version4+get-12775@lists.php.net to get a copy of this message
Howdy folks, I'm working on writing a C test application to test the robustness of sessions. I basically need to validate to myself that I can use this on a very high traffic site. So I wrote a simple multithreaded app that just makes simple http GET requests for a small php page that I wrote. The only thing that this app does is spawn off n number of threads to make x number of back to back requests of the same url. It parses out the PHPSESSID cookie from the response header the first time it sees it, to use in subsiquent GET requests to maintain the session. Below is my simple php page which gets called over and over for each thread. <? session_start(); ?> <html> <? if (!isset($count)) { session_register("count"); $count = 1; echo "\nNEW SESSION\n"; } else $count++; ?> COUNT=<? echo $count; ?>; times.<br> </html> My problem I'm having is that I'm seeing a session not really working properly. Below is the output of my app. I have the output of all of the threads going to individual files, so I can make sense of the output. As you see from the output (below), the app makes 2 requests for the same file on the server. The first request gets a response to set the PHPSESSID cookie and the output of the php script shows that the session is new and the count variable's value is 1. The app then makes the second request for the same file on the server with the PHPSESSID cookie set with the appropriate value. The problem is the second response. According to the second response, the session variable $count wasn't set, and so it re-registers the variable again and the assigns it to 1 again. This seems like a bug to me. The really odd thing is, this only happens when I run the test app on a different machine then the web server. If I run the test app on the same machine as the test server sessions seem to start and work appropriately. Does anyone have any ideas of what I might look at? Is this a bug? Could the server GET requests be malformed? Thanks Walt thread 1 started GET /rc/php/test/test_session.php HTTP/1.0 User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686) Host: 10.1.0.69 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso-8859-1,*,utf-8 REQUEST(0) GET /rc/php/test/test_session.php HTTP/1.0 User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686) Host: 10.1.0.69 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso-8859-1,*,utf-8 RESPONSE(0) HTTP/1.1 200 OK^M Date: Wed, 29 Mar 2000 04:28:24 GMT^M Server: Apache/1.3.12 Ben-SSL/1.39 (Unix) PHP/4.0RC1^M Set-Cookie: Apache=10.1.0.79.2060954304104670; path=/^M X-Powered-By: PHP/4.0RC1^M Set-Cookie: PHPSESSID=793e2564f9581b193f6f732a9c075aba; path=/; domain=.rocketcash.com^M Expires: Thu, 19 Nov 1981 08:52:00 GMT^M Cache-Control: no-cache, post-check=0, pre-check=0^M Pragma: no-cache^M Connection: close^M Content-Type: text/html; charset=iso-8859-1^M ^M <html> NEW SESSION COUNT=1; times.<br> </html> New COOKIE: PHPSESSID=793e2564f9581b193f6f732a9c075aba REQUEST(1) GET /rc/php/test/test_session.php HTTP/1.0 User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i686) Host: 10.1.0.69 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png Accept-Encoding: gzip Accept-Language: en Accept-Charset: iso-8859-1,*,utf-8 Cookie: PHPSESSID=793e2564f9581b193f6f732a9c075aba RESPONSE(1) HTTP/1.1 200 OK^M Date: Wed, 29 Mar 2000 04:28:24 GMT^M Server: Apache/1.3.12 Ben-SSL/1.39 (Unix) PHP/4.0RC1^M Set-Cookie: Apache=10.1.0.79.2063954304104677; path=/^M X-Powered-By: PHP/4.0RC1^M Expires: Thu, 19 Nov 1981 08:52:00 GMT^M Cache-Control: no-cache, post-check=0, pre-check=0^M Pragma: no-cache^M Connection: close^M Content-Type: text/html; charset=iso-8859-1^M ^M <html> NEW SESSION COUNT=1; times.<br> </html>

« previous php.version4 (#12775) next »