You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both of these metrics function like a counter, instead of a guage:
proxy.process.http.current_server_connections
proxy.process.http.current_server_transactions
Hmm. Interestingly enough current_server_transactions is broken on my H2 to origin build. Our build based against 9.0.1 is also looking good. Are you actually leaking Http1ServerSession objects?
This is just a possibility, but I thought it's worth noting.
Seems like removal of sessions from the pool depends on inactivity timeout of sessions (or underlying netvcs). If the timeout didn't happen on a session, the session would stay in the pool forever, unless other controls (e.g. per_server.connection.max) kick in.
This line below is suspecious, because it relies on the inactive timeout value currently set. If inactivity timeout is cancelled or set to 0, it does nothing. I think we need to read the original value from the config.
This is just a possibility, but I thought it's worth noting.
Seems like removal of sessions from the pool depends on inactivity timeout of sessions (or underlying netvcs). If the timeout didn't happen on a session, the session would stay in the pool forever, unless other controls (e.g. per_server.connection.max) kick in.
This line below is suspecious, because it relies on the inactive timeout value currently set. If inactivity timeout is cancelled or set to 0, it does nothing. I think we need to read the original value from the config.
isn't that a configuration bug? Why would you set inactive timeout to zero?
I think fb6ca11 has a bug. Making keep_alive_no_activity_timeout_out overridable is fine, but using overridden values after detaching a session from a transaction doesn't make much sense. That behavior means "I want to keep this session in the pool for a shorter/longer time than the default after using it for this transaction".
I checked the number of sessions in session pool by using #7627, and the number seemed reasonable. It didn't keep going up at minimum. So the leak probably happens outside of the pool and there should be a case that doesn't release (or close) server sessions.
Just making a note that 9.1.x is not showing problems with the current_* metrics in our production environment. But we didn't notice problems with 9.0.1 either. We aren't using the parent selection logic through.
The clearing of the server_session in HttpSM::kill_this is concerning. As discussed in the "Cleaning up" session of my notes on the H2 to origin PR notes, there are multiple references to the server_session in the tunnel, server_entry, and in the server_session member variable. With the H2 to origin keeping track of all of that was made even worse by the possibility of two origin classes. Any kind of characterization of the leaking transaction scenario would be useful. It is quite likely that we are leaking too, but given our transaction distribution not at such a high rate.
I'll think some more if we can backport a more systematic means of ensuring the server_session has been freed by the time we get to HttpSM::kill_this. Just calling do_io_close against the server_session object in HttpSM::kill_this is unlikely to work since there are many cases where the HttpServerSession object has already been freed (via the tunnel or the server_entry).
I've been running 9.0.1 for about 24 hours and seeing this as well. The internal connection count seems to just tick up and up, but the connections don't seem to exist. Running traffic_ctl over and over, I do see it go down at times but the overall trend is to grow and grow.
15867 is the pid of traffic_server
lsof -n -p 15867 | wc -l
106540
traffic_ctl metric get proxy.process.net.connections_currently_open
proxy.process.net.connections_currently_open 108760
traffic_ctl metric get proxy.process.http.current_server_connections
proxy.process.http.current_server_connections 160043
traffic_ctl metric get proxy.process.current_server_connections
proxy.process.current_server_connections 159993
We don't use parents so this is normal...
traffic_ctl metric get proxy.process.http.current_parent_proxy_connections
proxy.process.http.current_parent_proxy_connections 0
netstat -ant | wc -l
25203
netstat -antp | grep 15867 | wc -l
8640
So somehow ATS thinks it has 4x the number of connections that the kernel thinks the entire box has and 12x the # of connections that the kernel thinks ATS has.
I'm also seeing a ton more CLOSE_WAITs compared to 8.1.1:
netstat -ant | grep CLOSE | wc -l
4462
On the other boxes in the same 3-node cluster (servicing the same VIPs and same backend origin sites, so extremely similar workload):
netstat -ant | grep CLOSE_WAIT | wc -l
39
netstat -ant | grep CLOSE_WAIT | wc -l
148
All my testing looked good (the throughput is in-line with the other 2 nodes in the cluster; sites load ok; etc), and I wouldn't have even noticed this except that we bumped into the connection limit:
[May 13 10:01:50.185] [ACCEPT 0:8080] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262149, net_connections_throttle=262144
[May 13 10:11:50.188] [ACCEPT 0:8443] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262169, net_connections_throttle=262144
[May 13 10:21:50.197] [ACCEPT 0:8443] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262263, net_connections_throttle=262144
[May 13 10:31:50.198] [ACCEPT 0:8443] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262208, net_connections_throttle=262144
[May 13 10:41:50.199] [ACCEPT 0:8080] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262147, net_connections_throttle=262144
I raised proxy.config.net.connections_throttle but the current count seems to creep up and up. I was scouring the upgrade docs to see if I missed something (which could still be the case) and came upon this ticket, so I figured I'd add some info.
No idea if it's related to this but in 9.0.1, I also see a steady of things like:
20210513.20h26m36s BODY_FACTORY: suppressing 'connect#failed_connect' response for url 'X@'
and
20210513.20h26m41s BODY_FACTORY: suppressing 'connect#failed_connect' response for url ''
My 8.1.1 nodes (same VIP, same workload, same backend origin sites) don't have a single equivalent log entry. They of course have entries for other URLs, but always for valid-ish looking URLs, never '' nor 'X@'. I've yet to find a corresponding log entry for the nginx instance that's fronting ATS. Again, I just mention this in the off chance that it's related to the above connection count issue.
@moseleymark what is your traffic like? Our traffic is a mix of pure proxy and smaller cached objects, and we're not seeing the problem. If it is not parent selection based, then presumably it is due to differences in traffic patterns.
This is all web hosting traffic, so it's got pretty random traffic patterns. All of my ATS nodes are doing reverse proxy to various parts of 2 /24s (on the same network). We control all the origin selection (all Lua talking to our own DNS), but the actual content could be anything from tiny files to large media files, could be static or dynamic. There are no parents at all, just each trafficserver box talking to origins.
I've been ramping up traffic to our 8.1.1 nodes but I'm starting to see a crash few every days with 8.1.1 ("Fatal: HttpSM.cc:2533: failed assertion magic == HTTP_SM_MAGIC_ALIVE, similar to #4921), so I was trying out 9.0.1. The traffic serving part looked great. It's just the connection leak that's an issue.
I reverted #7237 and #7336 then the stats got steady. I think the cause is #7237 but I had to revert #7336 as well because it's an additional fix for #7237 (there's dependency).
I just noticed on a machine running 9.1.x a little bit of a server session leak. It had been running for 8 hours. Took it out of rotation, and still the proxy.process.http.current_server_connections is around 1000 even though according to the OS only about 30 connections are open to the origin.
We are running with a couple differences on our internal 9.0.x branch from what is on ASF. With 9.1.x we reset against the ASF branch, so that could be why we are starting to see a slow leak.
I am working through differences in HttpTunnel. Just bringing over our 9.0 version into our 9.1 build seems to have plugged the leak, but also I may not have waited long enough.
One HttpTunnel difference is that our 9.0 included PR #7386 which did not land in ASF.
There was also a slight difference between what we started with in #7237 and what landed in ASF which remained in our build.
Will continue to try different variations and see how the builds work out.
I think PR #7386 is the difference. I added that to our 9.1.x build. Without that change, we leaked around 6000 origin sessions over the period of a day. With the change, I ran it for an hour or so, then took it out of rotation. The output of the following commands matched each other nicely as the system drained.
Activity
c-taylor commentedon Feb 5, 2021
This affects both:
proxy.process.http.current_parent_proxy_connections
proxy.process.http.current_server_connections
Behaviour is constantly additive. Do not see decrements.
zwoop commentedon Feb 5, 2021
proxy.process.http.current_server_connections is a derivative metric too, which derives from
c-taylor commentedon Feb 10, 2021
I believe this issue also gives a 'false positive' for
proxy.config.http.per_server.connection.max.Trying to confirm this now...
shinrich commentedon Mar 4, 2021
Interesting, in our 9.0.x build both look ok. From a server running at low time.
I'll double check to make sure we have everything pushed forward.
shinrich commentedon Mar 4, 2021
Hmm. Interestingly enough current_server_transactions is broken on my H2 to origin build. Our build based against 9.0.1 is also looking good. Are you actually leaking Http1ServerSession objects?
shinrich commentedon Mar 4, 2021
One difference in our environments is that you use parent proxy. Does you proxy.process.http.current_parent_proxy_connections setting look ok?
c-taylor commentedon Mar 5, 2021
maskit commentedon Mar 10, 2021
What a mess.
maskit commentedon Mar 15, 2021
It doesn't seem like a stat issue. According to memory usage dump (SIGUSR1),
Http1ServerSessionis leaking.maskit commentedon Mar 17, 2021
This is just a possibility, but I thought it's worth noting.
Seems like removal of sessions from the pool depends on inactivity timeout of sessions (or underlying netvcs). If the timeout didn't happen on a session, the session would stay in the pool forever, unless other controls (e.g.
per_server.connection.max) kick in.This line below is suspecious, because it relies on the inactive timeout value currently set. If inactivity timeout is cancelled or set to 0, it does nothing. I think we need to read the original value from the config.
trafficserver/proxy/http/HttpSessionManager.cc
Line 215 in d4fc16f
trafficserver/iocore/net/P_UnixNetVConnection.h
Lines 348 to 352 in d4fc16f
trafficserver/iocore/net/UnixNetVConnection.cc
Lines 1354 to 1360 in d4fc16f
trafficserver/iocore/net/P_UnixNetVConnection.h
Lines 362 to 368 in d4fc16f
vmamidi commentedon Mar 17, 2021
isn't that a configuration bug? Why would you set inactive timeout to zero?
maskit commentedon Mar 17, 2021
There is a couple of lines set it to 0. And as you can see
cancel_inactivity_timeout()set it to 0 too.But I'm not disagreeing that the issue is caused by misconfiguration. There might be something that saves the infinite inactivity timeout case.
maskit commentedon Mar 18, 2021
I think fb6ca11 has a bug. Making
keep_alive_no_activity_timeout_outoverridable is fine, but using overridden values after detaching a session from a transaction doesn't make much sense. That behavior means "I want to keep this session in the pool for a shorter/longer time than the default after using it for this transaction".https://issues.apache.org/jira/browse/TS-863
maskit commentedon Apr 16, 2021
#7618 didn't work for this.
I checked the number of sessions in session pool by using #7627, and the number seemed reasonable. It didn't keep going up at minimum. So the leak probably happens outside of the pool and there should be a case that doesn't release (or close) server sessions.
shinrich commentedon Apr 28, 2021
Just making a note that 9.1.x is not showing problems with the current_* metrics in our production environment. But we didn't notice problems with 9.0.1 either. We aren't using the parent selection logic through.
shinrich commentedon May 5, 2021
Do you notice that file descriptors are not being closed as well as server sessions being leaked?
shinrich commentedon May 5, 2021
The clearing of the server_session in HttpSM::kill_this is concerning. As discussed in the "Cleaning up" session of my notes on the H2 to origin PR notes, there are multiple references to the server_session in the tunnel, server_entry, and in the server_session member variable. With the H2 to origin keeping track of all of that was made even worse by the possibility of two origin classes. Any kind of characterization of the leaking transaction scenario would be useful. It is quite likely that we are leaking too, but given our transaction distribution not at such a high rate.
https://docs.google.com/document/d/1sK6AyR-1K795NHsJqpRp4pjZRJ7T5KM78uJlRFMpKiI/edit?usp=sharing
I'll think some more if we can backport a more systematic means of ensuring the server_session has been freed by the time we get to HttpSM::kill_this. Just calling do_io_close against the server_session object in HttpSM::kill_this is unlikely to work since there are many cases where the HttpServerSession object has already been freed (via the tunnel or the server_entry).
moseleymark commentedon May 14, 2021
I've been running 9.0.1 for about 24 hours and seeing this as well. The internal connection count seems to just tick up and up, but the connections don't seem to exist. Running traffic_ctl over and over, I do see it go down at times but the overall trend is to grow and grow.
15867 is the pid of traffic_server
We don't use parents so this is normal...
So somehow ATS thinks it has 4x the number of connections that the kernel thinks the entire box has and 12x the # of connections that the kernel thinks ATS has.
I'm also seeing a ton more CLOSE_WAITs compared to 8.1.1:
On the other boxes in the same 3-node cluster (servicing the same VIPs and same backend origin sites, so extremely similar workload):
All my testing looked good (the throughput is in-line with the other 2 nodes in the cluster; sites load ok; etc), and I wouldn't have even noticed this except that we bumped into the connection limit:
[May 13 10:01:50.185] [ACCEPT 0:8080] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262149, net_connections_throttle=262144
[May 13 10:11:50.188] [ACCEPT 0:8443] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262169, net_connections_throttle=262144
[May 13 10:21:50.197] [ACCEPT 0:8443] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262263, net_connections_throttle=262144
[May 13 10:31:50.198] [ACCEPT 0:8443] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262208, net_connections_throttle=262144
[May 13 10:41:50.199] [ACCEPT 0:8080] WARNING: too many connections, throttling. connection_type=ACCEPT, current_connections=262147, net_connections_throttle=262144
I raised proxy.config.net.connections_throttle but the current count seems to creep up and up. I was scouring the upgrade docs to see if I missed something (which could still be the case) and came upon this ticket, so I figured I'd add some info.
No idea if it's related to this but in 9.0.1, I also see a steady of things like:
20210513.20h26m36s BODY_FACTORY: suppressing 'connect#failed_connect' response for url 'X@'
and
20210513.20h26m41s BODY_FACTORY: suppressing 'connect#failed_connect' response for url ''
My 8.1.1 nodes (same VIP, same workload, same backend origin sites) don't have a single equivalent log entry. They of course have entries for other URLs, but always for valid-ish looking URLs, never '' nor 'X@'. I've yet to find a corresponding log entry for the nginx instance that's fronting ATS. Again, I just mention this in the off chance that it's related to the above connection count issue.
shinrich commentedon May 17, 2021
@moseleymark what is your traffic like? Our traffic is a mix of pure proxy and smaller cached objects, and we're not seeing the problem. If it is not parent selection based, then presumably it is due to differences in traffic patterns.
moseleymark commentedon May 17, 2021
This is all web hosting traffic, so it's got pretty random traffic patterns. All of my ATS nodes are doing reverse proxy to various parts of 2 /24s (on the same network). We control all the origin selection (all Lua talking to our own DNS), but the actual content could be anything from tiny files to large media files, could be static or dynamic. There are no parents at all, just each trafficserver box talking to origins.
I've been ramping up traffic to our 8.1.1 nodes but I'm starting to see a crash few every days with 8.1.1 ("Fatal: HttpSM.cc:2533: failed assertion
magic == HTTP_SM_MAGIC_ALIVE, similar to #4921), so I was trying out 9.0.1. The traffic serving part looked great. It's just the connection leak that's an issue.maskit commentedon May 20, 2021
I reverted #7237 and #7336 then the stats got steady. I think the cause is #7237 but I had to revert #7336 as well because it's an additional fix for #7237 (there's dependency).
shinrich commentedon May 25, 2021
Interesting. I'll work with #7237.
I just noticed on a machine running 9.1.x a little bit of a server session leak. It had been running for 8 hours. Took it out of rotation, and still the proxy.process.http.current_server_connections is around 1000 even though according to the OS only about 30 connections are open to the origin.
shinrich commentedon May 25, 2021
We are running with a couple differences on our internal 9.0.x branch from what is on ASF. With 9.1.x we reset against the ASF branch, so that could be why we are starting to see a slow leak.
I am working through differences in HttpTunnel. Just bringing over our 9.0 version into our 9.1 build seems to have plugged the leak, but also I may not have waited long enough.
One HttpTunnel difference is that our 9.0 included PR #7386 which did not land in ASF.
There was also a slight difference between what we started with in #7237 and what landed in ASF which remained in our build.
Will continue to try different variations and see how the builds work out.
shinrich commentedon May 25, 2021
I think PR #7386 is the difference. I added that to our 9.1.x build. Without that change, we leaked around 6000 origin sessions over the period of a day. With the change, I ran it for an hour or so, then took it out of rotation. The output of the following commands matched each other nicely as the system drained.
I will reopen PR #7386.
shinrich commentedon May 25, 2021
I removed the changes in from PR #7386 from our 9.0.x build, and now that test build is showing some origin session leaking.
maskit commentedon May 26, 2021
I've been running a test build with the change from #7386 for an hour, and I don't see the leak.