actix-net icon indicating copy to clipboard operation
actix-net copied to clipboard

MAX_CONN_COUNTER will always increase, no decrease

Open clia opened this issue 4 years ago • 3 comments

The number setted with max_connection_rate will exceed after a period of time of running. I checked the code about lib.rs and openssl.rs in actix-tls/src, and can find only the code to increase the MAX_CONN_COUNTER counter, no decreasing action. I think this is a bug.

clia avatar Sep 22 '20 14:09 clia

From what i can see, the thread local counter is incremented when a guard is created and decremented when the guard is dropped. Can you show where you think the problem is?

robjtede avatar Sep 22 '20 21:09 robjtede

RAII type guard with operation on drop is a normal pattern in Rust. It's a feature.

fakeshadow avatar Sep 23 '20 03:09 fakeshadow

actix-issue Yes it will decrease, but the counter num will totally increase over time. We are running a SSE long-polling connections service, I set the max_connection_rate to 2560. When the most clients has connected to our server, and the connections peak is over, the connection count is decreasing, the MAX_CONN_COUNTER value is still increasing, reaches the limit, while the connection rate is obviously low.

clia avatar Sep 23 '20 03:09 clia