mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 07:11:20 +02:00
Mailing list participant "mlist" reported negative conn_cur values in stick tables as the result of "tcp-request connection track-sc". The reason is that after the stick entry it copied from the session to the stream, both the session and the stream grab a reference to the entry and when the stream ends, it decrements one reference and one connection, then the same is done for the session. In fact this problem was already encountered slightly differently in the past and addressed by Thierry using the patch below as it was believed by then to be only a refcount issue since it was the observable symptom : 827752e "BUG/MEDIUM: stick-tables: refcount error after copying SC..." In reality the problem is that the stream must touch neither the refcount nor the connection count for entries it inherits from the session. While we have no way to tell whether a track entry was inherited from the session (since they're simply memcpy'd), it is possible to prevent the stream from touching an entry that already exists in the session because that's a guarantee that it was inherited from it. Note that it may be a temporary fix. Maybe in the future when a session gives birth to multiple streams we'll face a situation where a session may be updated to add more tracked entries after instanciating some streams. The correct long-term fix is to mark some tracked entries as shared or private (or RO/RW). That will allow the session to track more entries even after the same trackers are being used by early streams. No backport is needed, this is only caused by the session/stream split in 1.6.