[sr-dev] [kamailio] fix race condition in tls module when checking available memory limits (#126)

Camille Oudot notifications at github.com
Tue Apr 14 20:02:17 CEST 2015


Under high load, the value returned by `shm_available()` can be total garbage, because it is not multiprocess safe. In the tls module, it makes the tests against the `low_mem_thresholdX` limits randomly return false positives, with errors such as:
```
ERROR: tls [tls_server.c:273]: tls_fix_connection(): tls: ssl bug #1491 workaround: not enough memory for safe operation: 88
```
although there is plenty of free shm memory.
 
This patch solves the issue by adding a safe version of the function.
You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/126

-- Commit Summary --

  * mem: add a multiprocess-safe shm_available()
  * tls: use multiprocess-safe shm_available()

-- File Changes --

    M mem/shm_mem.c (8)
    M mem/shm_mem.h (5)
    M modules/tls/tls_server.c (4)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/126.patch
https://github.com/kamailio/kamailio/pull/126.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/126
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20150414/a48917ae/attachment.html>


More information about the sr-dev mailing list