You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Lars Ködderitzsch (Jira)" <ji...@apache.org> on 2021/09/15 06:20:00 UTC
[jira] [Updated] (CXF-8597) CXF JAXRS client not closing HTTP
connections
[ https://issues.apache.org/jira/browse/CXF-8597?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lars Ködderitzsch updated CXF-8597:
-----------------------------------
Description:
After upgrading vom cxf-3.3.4 to 4.4.3 we noticed large numbers of HTTP connections remaining in CLOSE_WAIT state, originating from JAXRS proxy clients - unfortunately in production first.
The open sockets lead to a total blockage of the system as file handles eventually are exhausted and no further addtional connections can be opened. At this point we see tens of thousands connections in CLOSE_WAIT.
During our investigation we spotted a substantial refactoring in [https://github.com/apache/cxf/blob/75fb6bb56d82f72771a9ee6ecab5d36168303f51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java#L424] which seems to cause the issue (parameter "closeAfterRead" being always false).
Please refer to the attached reproducer project which demonstrates the issue - the underlying HttpUrlConnection never being closed inc cxf-3.4.3/3.4.4. By changing the build.gradle.kts of the reproducer to use cxf-3.3.4 the included test case is working.
If possible please advise a workaround. Our initial attempts to get "behind" ResponseImpl#doReadEntity via the client interceptor chain were unsuccessful.
For the time being production operators are forcibly removing CLOSE_WAIT connections by OS means ("{{ss --tcp state CLOSE-WAIT '( dport = <api-gateway-port> )' --kill}}")
was:
After upgrading vom cxf-3.3.4 to 4.4.3 we noticed large numbers of HTTP connections remaining in CLOSE_WAIT state, originating from JAXRS proxy clients - unfortunately in production first.
The open sockets lead to a total blockage of the system as file handles eventually are exhausted and no further addtional connections can be opened. At this point we see tens of thousands connections in CLOSE_WAIT.
During our investigation we spotted a substantial refactoring in [https://github.com/apache/cxf/blob/75fb6bb56d82f72771a9ee6ecab5d36168303f51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java#L424] which seems to cause the issue (parameter "closeAfterRead" being always false).
Please refer to the attached reproducer project which demonstrates the issue - the underlying HttpUrlConnection never being closed inc cxf-3.4.3/3.4.4. By changing the build.gradle.kts of the reproducer to use cxf-3.3.4 the included test case is working.
If possible please advise a workaround. Our initial attempts to get "behind" ResponseImpl#doReadEntity via the client interceptor chain were unsuccessful.
For the time being production operators are forcibly removing CLOSE_WAIT connections bmy OS means ("{{ss --tcp state CLOSE-WAIT '( dport = <api-gateway-port> )' --kill}}")
> CXF JAXRS client not closing HTTP connections
> ---------------------------------------------
>
> Key: CXF-8597
> URL: https://issues.apache.org/jira/browse/CXF-8597
> Project: CXF
> Issue Type: Bug
> Components: JAX-RS
> Affects Versions: 3.4.3, 3.4.4
> Environment: CXF 3.4.3/3.4.4
> OpenJDK 11.11
> Reporter: Lars Ködderitzsch
> Priority: Critical
> Attachments: cxf-jaxrs-connection-close.zip
>
>
> After upgrading vom cxf-3.3.4 to 4.4.3 we noticed large numbers of HTTP connections remaining in CLOSE_WAIT state, originating from JAXRS proxy clients - unfortunately in production first.
> The open sockets lead to a total blockage of the system as file handles eventually are exhausted and no further addtional connections can be opened. At this point we see tens of thousands connections in CLOSE_WAIT.
> During our investigation we spotted a substantial refactoring in [https://github.com/apache/cxf/blob/75fb6bb56d82f72771a9ee6ecab5d36168303f51/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/ResponseImpl.java#L424] which seems to cause the issue (parameter "closeAfterRead" being always false).
> Please refer to the attached reproducer project which demonstrates the issue - the underlying HttpUrlConnection never being closed inc cxf-3.4.3/3.4.4. By changing the build.gradle.kts of the reproducer to use cxf-3.3.4 the included test case is working.
>
> If possible please advise a workaround. Our initial attempts to get "behind" ResponseImpl#doReadEntity via the client interceptor chain were unsuccessful.
> For the time being production operators are forcibly removing CLOSE_WAIT connections by OS means ("{{ss --tcp state CLOSE-WAIT '( dport = <api-gateway-port> )' --kill}}")
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)