Re: topos_htable autoexpire not working

Stefan Mititelu via sr-users <[email protected]> Wed, 11 Mar 2026 15:11:52 +0200
Newsgroups gmane.comp.voip.ser
Message-ID <CABBe6Cy3-52hOsLYmoGeCE3nHH31ZNDd+FY8djb4jRy7_wgEPg@mail.gmail.com>
Hi,

Note that the htable entries should be expired by the htable timer, when
timer triggers.

1. Do you have anything set for this modparam [1] ?

2. You can try and compare this basic test with setting this htable
modparam [2]

3. You can try and compare this basic test with adding ";updateexpire=0" to
your "topos_htable"s

Thanks,
Stefan

[1]
https://kamailio.org/docs/modules/stable/modules/htable.html#htable.p.timer_interval
[2]
https://kamailio.org/docs/modules/stable/modules/htable.html#htable.p.timer_procs

On Wed, Mar 11, 2026 at 12:55 AM Ivan Ribakov via sr-users <
[email protected]> wrote:

> I have Kamailio 6.0.6. I'm using topos module with topos_htable storage
> backend. Since enabling topos+topos_htable in production I observed slow
> but steady shared memory consumption increase to the point where Kamailio
> ultimately runs out of shared memory.
>
> In attempt to create an MRE, I have boiled down the config to the
> following module params:
>
> modparam("topos", "storage", "htable")
> modparam("topos", "branch_expire", 60)
> modparam("topos", "dialog_expire", 60)
> modparam("topos", "clean_interval", 60)
> modparam("topos", "rr_update", 1)
> modparam("topos", "methods_noinitial", "OPTIONS,NOTIFY")
> modparam("topos", "contact_host", KAM_ROUTER_PRIVATE_IP)
> modparam("topos_htable", "topos_htable_dialog",
> "topos_dialog=>size=14;autoexpire=60")
> modparam("topos_htable", "topos_htable_transaction",
> "topos_transaction=>size=14;autoexpire=60")
>
> My expectation is that this config will only store up to a minute of topos
> data, at which point htable autoexpiry will start freeing up shared memory.
>
> I set up a SIPp test that throws a call at Kamilio that routes to
> non-existing destination and INVITE TX times out after 5sec and 408 is
> returned to the SIPp UAC. I'm generating 200 calls per second up to 1K
> concurrent calls.
>
> Below are the prettified core.shmmem output for first 2 minutes with
> topos/topos_htable enabled:
>
> | Timestamp   | Total     | Free     | Used     | Real_Used   | Max_Used
> |   Fragments |
>
> |:------------|:----------|:---------|:---------|:------------|:-----------|------------:|
> | 21:12:25    | 100.00 MB | 94.71 MB | 5.29 MB  | 5.29 MB     | 5.29 MB
>  |           1 |
> | 21:12:35    | 100.00 MB | 42.13 MB | 57.87 MB | 57.87 MB    | 57.87 MB
> |           2 |
> | 21:12:45    | 100.00 MB | 35.59 MB | 65.16 MB | 64.41 MB    | 65.16 MB
> |          38 |
> | 21:12:55    | 100.00 MB | 30.79 MB | 69.79 MB | 69.21 MB    | 69.79 MB
> |          55 |
> | 21:13:05    | 100.00 MB | 30.43 MB | 70.87 MB | 69.57 MB    | 70.87 MB
> |          70 |
> | 21:13:15    | 100.00 MB | 26.33 MB | 73.67 MB | 73.67 MB    | 73.67 MB
> |           2 |
> | 21:13:25    | 100.00 MB | 24.50 MB | 76.12 MB | 75.50 MB    | 76.12 MB
> |         222 |
> | 21:13:35    | 100.00 MB | 21.30 MB | 78.91 MB | 78.70 MB    | 78.91 MB
> |         244 |
> | 21:13:45    | 100.00 MB | 18.66 MB | 82.26 MB | 81.34 MB    | 82.26 MB
> |         283 |
> | 21:13:55    | 100.00 MB | 17.54 MB | 83.72 MB | 82.46 MB    | 83.72 MB
> |         323 |
> | 21:14:05    | 100.00 MB | 14.49 MB | 86.74 MB | 85.51 MB    | 86.74 MB
> |         357 |
> | 21:14:15    | 100.00 MB | 14.85 MB | 86.74 MB | 85.15 MB    | 86.74 MB
> |         332 |
> | 21:14:25    | 100.00 MB | 14.00 MB | 86.97 MB | 86.00 MB    | 86.97 MB
> |         263 |
>
> And here are the results for the same test with
> topos/topos_htable disabled:
>
> | Timestamp   | Total     | Free     | Used     | Real_Used   | Max_Used
> |   Fragments |
>
> |:------------|:----------|:---------|:---------|:------------|:-----------|------------:|
> | 21:16:00    | 100.00 MB | 94.62 MB | 5.38 MB  | 5.38 MB     | 5.38 MB
>  |           1 |
> | 21:16:10    | 100.00 MB | 44.01 MB | 55.99 MB | 55.99 MB    | 55.99 MB
> |           1 |
> | 21:16:20    | 100.00 MB | 40.60 MB | 59.49 MB | 59.40 MB    | 59.49 MB
> |           2 |
> | 21:16:30    | 100.00 MB | 43.20 MB | 59.49 MB | 56.80 MB    | 59.49 MB
> |           6 |
> | 21:16:40    | 100.00 MB | 41.02 MB | 59.49 MB | 58.98 MB    | 59.49 MB
> |           3 |
> | 21:16:50    | 100.00 MB | 41.83 MB | 59.49 MB | 58.17 MB    | 59.49 MB
> |           4 |
> | 21:17:00    | 100.00 MB | 40.20 MB | 60.15 MB | 59.80 MB    | 60.15 MB
> |           3 |
> | 21:17:10    | 100.00 MB | 40.58 MB | 60.81 MB | 59.42 MB    | 60.81 MB
> |          12 |
> | 21:17:20    | 100.00 MB | 40.49 MB | 60.81 MB | 59.51 MB    | 60.81 MB
> |          15 |
> | 21:17:30    | 100.00 MB | 38.81 MB | 61.19 MB | 61.19 MB    | 61.19 MB
> |           2 |
> | 21:17:40    | 100.00 MB | 38.46 MB | 62.50 MB | 61.54 MB    | 62.50 MB
> |           7 |
> | 21:17:50    | 100.00 MB | 36.74 MB | 63.27 MB | 63.26 MB    | 63.27 MB
> |           2 |
> | 21:18:00    | 100.00 MB | 37.51 MB | 63.27 MB | 62.49 MB    | 63.27 MB
> |           7 |
>
> In both cases dlg.stats shows no more than 1K active dialogs. However
> shmmem does not appear to be freed up after 60sec with topos/topos_htable
> enabled.
>
> Is my understanding of the "autoexpire" incorrect or is this a bug in
> topos/topos_htable?
>
>
>
> *IVAN RIBAKOV*
> Lead Engineer
>
> *__________________________________________*
>
> CAIT, Campus Montegancedo,
>
> Pozuelo de Alarcón 28223
>
> Madrid - Spain
>
> [image: https://www.linkedin.com/company/18014823]
> <https://www.linkedin.com/company/18014823>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions --
> [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
>

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!