Dear all,
Looks like pound doesn't always keep sticky (cookie-based) sessions
forwarded to the same backend.
This is cut-down log from LiveHTTPHeaders
----------------------------------------------------------
GET /over.gif HTTP/1.1
Host: www.host.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl-NL; rv:1.7.12)
Gecko/20050919 Firefox/1.0.7
Accept: image/png,*/*;q=0.5
Accept-Language: nl-NL,nl;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=698109120e94ba73f82de4976a293cf6
HTTP/1.x 200 OK
Date: Wed, 07 Jun 2006 17:31:47 GMT
Server: Apache/2.0.55 (Unix) DAV/2 PHP/4.3.11
Last-Modified: Sun, 28 May 2006 19:47:07 GMT
Etag: "9e73e-749-777fc4c0"
Accept-Ranges: bytes
Content-Length: 1865
X-Served-by: fe03
Connection: close
Content-Type: image/gif
----------------------------------------------------------
X-Served-by is a custom header, added by Apache to indicate which backend
requests are forwarded to.
fe01, fe02, fe03... and so on.
So far so good, all requests in this session were served from fe03.
Now I want to enter area protected with basic authorization:
----------------------------------------------------------
HEAD /content/piece123.avi HTTP/1.1
Host: www.host.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl-NL; rv:1.7.12)
Gecko/20050919 Firefox/1.0.7
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
Accept-Language: nl-NL,nl;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=698109120e94ba73f82de4976a293cf6
Pragma: no-cache
Cache-Control: no-cache
...and here, BOOM!..
HTTP/1.x 401 Authorization Required
Date: Wed, 07 Jun 2006 17:31:48 GMT
Server: Apache/2.0.55 (Unix) DAV/2 PHP/4.3.11
WWW-Authenticate: Basic realm="Please enter your loginname and password"
Connection: close
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
The browser shows famous gray window with basic auth.
Now, requests are sent with auth header.
----------------------------------------------------------
HEAD /content/piece123.avi HTTP/1.1
Host: www.oldje.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl-NL; rv:1.7.12)
Gecko/20050919 Firefox/1.0.7
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=
0.8,image/png,*/*;q=0.5
Accept-Language: nl-NL,nl;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=698109120e94ba73f82de4976a293cf6
Pragma: no-cache, no-cache
Cache-Control: no-cache, no-cache
Authorization: Basic bG9naWNhbDptbzJkZWxsZW4=
HTTP/1.x 200 OK
Date: Wed, 07 Jun 2006 17:32:21 GMT
Server: Apache/2.0.55 (Unix) DAV/2 PHP/4.3.11
Last-Modified: Mon, 29 May 2006 15:12:40 GMT
Etag: "a1fde-11558b3-bfd4aa00"
Accept-Ranges: bytes
Content-Length: 18176179
X-Served-by: fe02
Connection: close
Content-Type: application/vnd.rn-content
----------------------------------------------------------
BOOM - now session is switched to fe02 - while fe03 is still alive and
healthy!
And from now on everything goes via fe02.
I witnessed several cases like this one.
The $1M question:
Could it be that 401 Authorization required answer from the backend server
disrupts somehow session tracking mechanics in pound?
Pound version is 1.10 here, because I had some strange segfaults with 2.0
and 2.0.x are not marked as stable yet.
So if possible, in future versions of Pound I'd like to see ALL cases when
session tracking is lost as an error, written explicitly in error log, with
relevant information like 'because backend server doesn't seem to breathe
anymore' or whatever.
Another feature request that I dare to express is that session <> backend
coupling could be probably made persistent, with berkeleydb or hash table or
something. This is because on every pound restart, this coupling is users
have to log on again. If this information can be persisted and flushed on
demand, pound can be restarted as often as I want without any side effects.
Regards,
Timur
[...]
|