简体   繁体   中英

CXF HTTP Connection pooling CLOSE_WAIT

I'm using CXF 3.0.6

I'm invoking a route using ProducerTemplate

I have an cxf endpoint as below in my camel context .. (TEST_ENDPOINT is an actual endpoint)

<route id="invokePostRestService">
        <from uri="direct:invokeWS" />
        <log message=" ${body}" />
       <to uri="cxf://{{TEST_ENDPOINT}}?dataFormat=payload&amp;loggingFeatureEnabled=true" />
       <log message=" ${body}" />
</route>


<http-conf:conduit name="*.http-conduit">
                <http-conf:client ConnectionTimeout="30000"
                        ReceiveTimeout="30000"  MaxRetransmits="1"
                        AllowChunking="false" />
        </http-conf:conduit>

        <bean id="systemProps"
                class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
                <property name="targetObject" value="#{@systemProperties}" />
                <property name="targetMethod" value="putAll" />
                <property name="arguments">
                        <util:properties>
                                <prop key="http.maxConnections">11</prop>

                        </util:properties>
                </property>
        </bean>

I think CXF logging is interfering with log4j.xml in Jetty/resources/log4j.xml somehow, that when i set logging level to ERROR in log4j.xml, i see that CLOSE_WAIT piling up and http.maxConnections goes above 100+ (as a fact its just 11, configured)

When i set logging mode to INFO in log4j.xml, everything works as expected and http.maxConnections is 11 !! which is as expected and no close_waits !

after debugging i see that Logging level is INFO in "org.apache.camel.processor.interceptor.BacklogDebugger" despite of ERROR in log4j.xml, can this be the cause of this issue ?

any help is appreciated ...

This might help someone else who is facing the same problem.

After debugging i found that when ever camel context is initialized, internally Logging interceptor ( Trace interceptor ) called BacklogTracer is also initialized which internally uses INFO as logging level.

so, add cxf:bus in context xml as below, reference -

http://cxf.apache.org/docs/bus-configuration.htmlc
<cxf:bus>
        <cxf:features>
            <cxf:logging />
        </cxf:features>
</cxf:bus>

and the in log4j.xml add this,

<logger name="org.apache.cxf" >
    <level value="INFO" />  
</logger>

hope this helps..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM