-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
What type of defect/bug is this?
Unexpected behaviour (obvious or verified by project member)
How can the issue be reproduced?
I'm observing this behavior using rlm_cache_redis
, not sure if this is module-specific or general. I think there are actually 2 distinct problems, but don't want to multiply issues that might have common source.
The easiest way is to deliberately misconfigure stack:
- redis.conf:
timeout 10
- freeradius/mod-enabled/cache:
cache {
driver = "rlm_cache_redis"
redis {
server = 127.0.0.1
pool {
start = 0
### default settings:
### lifetime = 0
### retry_delay = 1
### max_retries = 5
### idle_timeout = 60
}
[...]
}
Start both servers, make them talk, wait a bit (let Redis close it's idles after 10 seconds) and make FR talk to Redis again. The connections would obviously fail, however I would expect FR to close it's end after the first failed attempt and restart fresh connection. Meanwhile such connections are being retried and fail over and over again.
Such misconfiguration isn't required, but it makes the first problem (not abandoning/fully resetting failing connections) easily visible. In fact my logs below are from Redis having timeout 100
(and this seems to be the second problem - reusing connections after idle_timeout
has already passed long time ago). With this config I had to wait for 60 seconds to see ERROR logs, yet tcpdump
shows there was the data actually returned from Redis (!).
Log output from the FreeRADIUS daemon
Please take a look at "connection (2)" [assuming this is some handle number] - it should be closed, as:
1. it's been rejected by Redis,
2. it's obsoleted (just like connections 4, 3, 1 and 0).
rlm_cache (cache_dhcp_accept): Reserved connection (1)
(2) cache_dhcp_accept: No cache entry found for "anonymized3"
rlm_cache (cache_dhcp_accept): Released connection (1)
[...]
rlm_cache (cache_dhcp_accept): Opening additional connection (3), 1 of 7 pending slots used
(2) [cache_dhcp_accept] = notfound
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (0)
(3) cache_dhcp_accept: Found entry for "anonymized"
(3) cache_dhcp_accept: Setting TTL to 1000
(3) cache_dhcp_accept: Merging cache entry into request
(3) cache_dhcp_accept: &reply:Framed-IP-Address = 10.11.12.16
rlm_cache (cache_dhcp_accept): Released connection (0)
[...]
rlm_cache (cache_dhcp_accept): Opening additional connection (4), 1 of 6 pending slots used
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (2)
(4) cache_dhcp_accept: ERROR: Failed retrieving entry for key "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (2)
rlm_cache (cache_dhcp_accept): You probably need to lower "min"
rlm_cache (cache_dhcp_accept): Closing expired connection (4) - Hit idle_timeout limit
rlm_cache (cache_dhcp_accept): You probably need to lower "min"
rlm_cache (cache_dhcp_accept): Closing expired connection (3) - Hit idle_timeout limit
rlm_cache (cache_dhcp_accept): You probably need to lower "min"
rlm_cache (cache_dhcp_accept): Closing expired connection (1) - Hit idle_timeout limit
rlm_cache (cache_dhcp_accept): You probably need to lower "min"
rlm_cache (cache_dhcp_accept): Closing expired connection (0) - Hit idle_timeout limit
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (2)
(4) cache_dhcp_accept: ERROR: Failed retrieving entry for key "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (2)
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (2)
(5) cache_dhcp_accept: ERROR: Failed retrieving entry for key "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (2)
Need 4 more connections to reach min connections (5)
Need more connections to reach 3 spares
rlm_cache (cache_dhcp_accept): Opening additional connection (5), 1 of 9 pending slots used
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (2)
(5) cache_dhcp_accept: ERROR: Failed retrieving entry for key "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (2)
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (5)
(6) cache_dhcp_accept: No cache entry found for "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (5)
Need 3 more connections to reach min connections (5)
Need more connections to reach 3 spares
rlm_cache (cache_dhcp_accept): Opening additional connection (6), 1 of 8 pending slots used
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (2)
(6) cache_dhcp_accept: ERROR: Failed retrieving entry for key "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (2)
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (5)
(7) cache_dhcp_accept: No cache entry found for "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (5)
Need 2 more connections to reach min connections (5)
Need more connections to reach 3 spares
rlm_cache (cache_dhcp_accept): Opening additional connection (7), 1 of 7 pending slots used
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (6)
(7) cache_dhcp_accept: No cache entry found for "anonymized"
(7) cache_dhcp_accept: Creating new cache entry
(7) cache_dhcp_accept: &reply::Framed-IP-Address += &reply:Framed-IP-Address[*] -> 10.11.12.16
(7) cache_dhcp_accept: Committed entry, TTL 1000 seconds
rlm_cache (cache_dhcp_accept): Released connection (6)
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (2)
(8) cache_dhcp_accept: ERROR: Failed retrieving entry for key "anonymized"
rlm_cache (cache_dhcp_accept): Released connection (2)
Need 1 more connections to reach min connections (5)
Need more connections to reach 3 spares
rlm_cache (cache_dhcp_accept): Opening additional connection (8), 1 of 6 pending slots used
[...]
rlm_cache (cache_dhcp_accept): Reserved connection (5)
(8) cache_dhcp_accept: Found entry for "anonymized"
(8) cache_dhcp_accept: Setting TTL to 1000
(8) cache_dhcp_accept: Told not to merge entry into request
rlm_cache (cache_dhcp_accept): Released connection (5)
Relevant log output from client utilities
$ tcpdump -npi lo tcp port 6379 -A
17:34:59.169681 IP 127.0.0.1.43366 > 127.0.0.1.6379: Flags [P.], seq 1:38, ack 1, win 260, options [nop,nop,TS val 3404957693 ecr 2568366423], length 37: RESP "GET" "anonymized"
$3
GET
$17
anonymized
17:34:59.169704 IP 127.0.0.1.6379 > 127.0.0.1.43366: Flags [R], seq 3034302121, win 0, length 0
17:38:30.390683 IP 127.0.0.1.48188 > 127.0.0.1.6379: Flags [P.], seq 83:120, ack 112, win 260, options [nop,nop,TS val 3405168914 ecr 2568585477], length 37: RESP "GET" "anonymized"
$3
GET
$17
anonymized
17:38:30.390712 IP 127.0.0.1.6379 > 127.0.0.1.48188: Flags [R], seq 1160069439, win 0, length 0
So the connections are dropped by Redis (which has higher idle timeout than FR).
Still, the connection with the same number (in my case: "connection (2)") still fails to provide responses, even when I see them on the wire.