Catching DB errors in sqlippool

Бенджамин Томпсон b.thompson at latera.ru
Tue Apr 10 21:41:53 CEST 2018


2018-04-10 21:14 GMT+03:00 Бенджамин Томпсон <b.thompson at latera.ru>:

>
>
>   Hmm... I can't fix the database problem.  But I will push a fix for
>> 3.0.17 which makes the module return "fail" in this situation.
>>
>>
> Tested, works, many thanks
>


The module now returns fail which is great. However I noticed that when I
call the sqlipool for a second time it skips the allocate_clear request and
goes straight to allocate_find:

(66) sqlippool: EXPAND %{User-Name}
(66) sqlippool:    --> testusername34
(66) sqlippool: SQL-User-Name set to 'testusername34'
(66) sqlippool: EXPAND START TRANSACTION
(66) sqlippool:    --> START TRANSACTION
(66) sqlippool: Executing query: START TRANSACTION
(66) sqlippool: EXPAND UPDATE radippool SET    nasipaddress     = '',
callingstationid = '', expiry_time      = NOW() - INTERVAL 1 SECOND WHERE
pool_key         = '%{User-Name}'
(66) sqlippool:    --> UPDATE radippool SET    nasipaddress     = '',
callingstationid = '', expiry_time      = NOW() - INTERVAL 1 SECOND WHERE
pool_key         = 'testusername34'
(66) sqlippool: Executing query: UPDATE radippool SET    nasipaddress     =
'', callingstationid = '', expiry_time      = NOW() - INTERVAL 1 SECOND
WHERE  pool_key         = 'testusername34'
(66) sqlippool: ERROR: rlm_sql_mysql: ERROR 1213 (WSREP detected
deadlock/conflict and aborted the transaction. Try restarting the
transaction): 40001
rlm_sql (sql): Released connection (4)
(66)     [sqlippool] = fail
(66)     if (!ok) {
(66)     if (!ok)  -> TRUE
(66)     if (!ok)  {
(66)       update reply {
(66)         &Framed-IP-Address !* ANY
(66)       } # update reply = noop
rlm_sql (sql): Reserved connection (0)
(66) sqlippool: EXPAND %{User-Name}
(66) sqlippool:    --> testusername34
(66) sqlippool: SQL-User-Name set to 'testusername34'
(66) sqlippool: EXPAND START TRANSACTION
(66) sqlippool:    --> START TRANSACTION
(66) sqlippool: Executing query: START TRANSACTION
(66) sqlippool: EXPAND SELECT framedipaddress FROM   radippool WHERE
pool_name   = '%{control:Pool-Name}' AND    (pool_key = '%{User-Name}' or
expiry_time < NOW()) ORDER BY (pool_key <> '%{User-Name}'), expiry_time
LIMIT 1 FOR UPDATE


I also tried to call do_not_respond but the problem is that it does not
seem to work in the post_auth section.


More information about the Freeradius-Users mailing list