You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (Jira)" <ji...@apache.org> on 2021/01/15 03:10:00 UTC

[jira] [Commented] (CXF-8410) HTTPTransportFactory's logger performs blocking call

    [ https://issues.apache.org/jira/browse/CXF-8410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17265654#comment-17265654 ] 

Andriy Redko commented on CXF-8410:
-----------------------------------

Hi [~fjmateo] ,

We should probably not put async and non-blocking into the same bucket. Indeed, CXF provides an asynchronous client APIs, but the initialization sequence (like for example loggers, etc) is inherently blocking operation. As it stays now, there are ways to force the initialization of certain classes (so the loggers fe are going to be initialized outside of the non-blocking flow) but it is going to be fragile and hacker-ish approach to be fair.

Probably the best way to pull it off is to shift the subscription to a different thread**, to adsorb the cost of the initialization:

    .subscribeOn(Schedulers.elastic())

It could be done for the first call only or just always shift the subscription to a different thread but understandably, the async nature of the CXF client becomes not very useful in this case. Also, I would encourage you to read [1] to understand implications of using JAX-WS client proxies in the multi-threaded apps. 

Hope it is helpful.

[1] [https://cxf.apache.org/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe]

Best Regards,

    Andriy Redko

> HTTPTransportFactory's logger performs blocking call
> ----------------------------------------------------
>
>                 Key: CXF-8410
>                 URL: https://issues.apache.org/jira/browse/CXF-8410
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 3.4.1
>            Reporter: Francisco Mateo
>            Priority: Major
>         Attachments: stacktrace.log
>
>
> I'm doing a POC using clients generated from wsdl2java and Spring Webflux.
> When I enable [BlockHound|https://github.com/reactor/BlockHound] to check for any blocking calls, the logger from HTTPTransportFactory blocks: [https://github.com/apache/cxf/blob/cxf-3.4.2/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPTransportFactory.java#L71]
> From debugging, when the logger is initialized, it attempts to load [https://github.com/apache/cxf/blob/cxf-3.4.2/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties]
> Loading that file from the containing JAR via ResourceBundle is a blocking operation as far as I can tell.
> My expectation is that when I use an async method from the generated client, there should not be any blocking calls made.
> I've created a sample project and a failing test that showcases the issue: [https://github.com/ciscoo/cxf-blockhound-webflux]
> I've also attached the stacktrace as well which shows the blocking call.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)