Le vendredi 12 novembre 2010 16:22:18, Hogan Yu a écrit : > Hi guys, > > Here is the access log for this bug.
You should definitely remove "nbproc 3". Also, as you're manipulating headers, you need "option httpclose" or "option server-close", else only the first request of a connection will be modified/analysed. Now what happened : > Nov 12 07:16:43 localhost haproxy[18627]: > 123.117.167.107:30281[12/Nov/2010:07:16:43.109] http_proxy > http_proxy/server2 0/0/0/109/618 200 > 2505 - JSESSIONID=abciT3I4wOv6YfMmpQaXs.1 --NI 0/0/0/0/0 0/0 "GET > /wap2/login.jsp HTTP/1.1" The first request comes without any cookie, the server creates one. "appsession" stores the association abciT3I4wOv6YfMmpQaXs.1=>server2 for your haproxy process pid 18627 (the pid is important for the next steps). PID 18627 : abciT3I4wOv6YfMmpQaXs.1=>server2 (created) > Nov 12 07:16:48 localhost haproxy[18626]: > 123.117.167.107:30291[12/Nov/2010:07:16:47.634] http_proxy > http_proxy/server1 0/0/0/473/997 200 > 1621 - JSESSIONID=abc_LqOuNI2_ldhwqQaXs.1 --NI 0/0/0/0/0 0/0 "POST > /wap2/j_security_check;jsessionid=abciT3I4wOv6YfMmpQaXs.1 HTTP/1.1" Here, your request provides a session id in the path-parameters, but the request was accept by the process 18626, which doesn't know that abciT3I4wOv6YfMmpQaXs.1 is associated to server2. The load balancing algorithm gives you the server1 which creates a new session. haproxy (pid 18626) associates abc_LqOuNI2_ldhwqQaXs.1 to server1 PID 18626 : abc_LqOuNI2_ldhwqQaXs.1 => server1 (created) PID 18627 : abciT3I4wOv6YfMmpQaXs.1 => server2 > Nov 12 07:16:55 localhost haproxy[18627]: > 123.117.167.107:30372[12/Nov/2010:07:16:53.452] http_proxy > http_proxy/server1 0/0/0/1305/1836 200 > 2558 - - --NI 0/0/0/0/0 0/0 "GET /wap2/checklist_skip.do; > jsessionid=abc_LqOuNI2_ldhwqQaXs.1?n=1&s=XlJdEHFYXUpXbEYIT2xNBhtFBEoVF0cHWx > 9bGEMR HTTP/1.1" Here you come with the previous session id, but not on the same pid => the load balancer thankfully sent the request to the server1, so it worked. PID 18626 : abc_LqOuNI2_ldhwqQaXs.1 => server1 PID 18627 : abciT3I4wOv6YfMmpQaXs.1 => server2 > Nov 12 07:17:04 localhost haproxy[18627]: > 123.117.167.107:30452[12/Nov/2010:07:17:04.032] http_proxy > http_proxy/server2 0/0/0/356/863 200 > 2672 - JSESSIONID=abc4JPQflUaXrbKuuQaXs.1 --NI 0/0/0/0/0 0/0 "GET > /wap2/profileViewWithCoinsReloadCheck.do;jsessionid=abc_LqOuNI2_ldhwqQaXs.1 > ?n=6&s=XlJdEHFYXUpXbEYIT2xNBhtFBEoVF0cHWx9bGEMR HTTP/1.1" But here, you are on a pid (18627) that doesn't know your session and the load balancer sent the request to server2, it fails and your server creates a new session. PID 18626 : abc_LqOuNI2_ldhwqQaXs.1 => server1 PID 18627 : abciT3I4wOv6YfMmpQaXs.1 => server2 PID 18627 : abc4JPQflUaXrbKuuQaXs.1 => server2 (created) > At the last line, when I access the page with > jsessionid=abc_LqOuNI2_ldhwqQaXs.1, The haproxy give me an new JSESSIONID. In fact, this is not haproxy but your backend server. -- Cyril Bonté

