LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

I think I found a minor bug in persistence time-outs.

To: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: I think I found a minor bug in persistence time-outs.
From: "Terry Green" <tgreen@xxxxxxxxx>
Date: Thu, 6 Feb 2003 10:36:37 -0500
Section 6.7.2 of the How to states:
"With persistent connection, the connection table doesn't clear till the persistence timeout (set with ipvsadm) time after the last client disconnects.   This time defaults to about 5 mins but can be much longer."
 
This appears to be not quite true.  
I'm using Kernel source 2.4.19 with patch 1.0.7
 
Testing/Observations
- using a port 80 definition with 5 minute persistence (keepalived being used to do the configs). 
    ipvsadm output:
  IP Virtual Server version 1.0.7 (size=16384)
  Prot LocalAddress:Port Scheduler Flags
     -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
  TCP  devlivelink:http rr persistent 300
     -> devlivelink2:http            Route   1      0          0         
     -> devlivelink1:http            Route   1      0          0         
  TCP  devlivelink:https rr persistent 300
     -> devlivelink2:https           Route   1      0          0         
     -> devlivelink1:https           Route   1      0          0
 
- now I start a connection to the web server for purposes of downloading a large file (which will take more than 5 minutes).   Every time I navigate, I see the connection template timeout reset to 5 minutes, as you would expect.
  ipvsadm -Lc output:
  TCP 04:59  NONE        greenblade.mitra.com:0 devlivelink:http   devlivelink1:http
  TCP 00:03  FIN_WAIT    greenblade.mitra.com:51330 devlivelink:http   devlivelink1:http
  TCP 00:02  FIN_WAIT    greenblade.mitra.com:51329 devlivelink:http   devlivelink1:http
- **note that I've shortened the TCP timeouts for purposes of testing using IPVS connection entries with
        ipvsadm --set 5 4 0
- however, if the template record is allowed to expire, it will be kept because there's still an active connection, but it's time will be reset to IP_VS_S_TIME_WAIT constant (defaulted to 2 minutes in ip_vs_conn.c) rather than to the persistence time set for this session.   Further, the data structure for the connection template appears to have been corrupted, as any further connections from the client reset the template time to 2 minutes instead of the original persistence time.   
 
- To verify this, I changed line 317 of ip_vs_conn.c from   
        [IP_VS_S_TIME_WAIT]     =       2*60*HZ, 
    to   
        [IP_VS_S_TIME_WAIT]     =       2*50*HZ,
    and recompile the kernel
 
- Running my tests again, I see the connection template record being reset to 1:40 instead of 2:00.
 
IPVS connection entries
pro expire state source virtual destination
TCP 04:50 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:05 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
IPVS connection entries
pro expire state source virtual destination
TCP 04:49 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:04 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
IPVS connection entries
pro expire state source virtual destination
TCP 04:48 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:04 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
IPVS connection entries
pro expire state source virtual destination
TCP 04:47 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:05 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
<later>
 
IPVS connection entries
pro expire state source virtual destination
TCP 00:02 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:04 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
IPVS connection entries
pro expire state source virtual destination
TCP 00:01 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:05 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
IPVS connection entries
pro expire state source virtual destination
TCP 01:39 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:05 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
IPVS connection entries
pro expire state source virtual destination
TCP 01:38 NONE greenblade.mitra.com:0 devlivelink:http devlivelink2:http
TCP 00:05 ESTABLISHED greenblade.mitra.com:51356 devlivelink:http devlivelink2:http
 
<Prev in Thread] Current Thread [Next in Thread>