Regarding thread safety of Woodstox

51 views
Skip to first unread message

Mantas Gridinas

unread,
Sep 27, 2019, 3:38:42 AM9/27/19
to Woodstox User Mailing List
Hi!

Lately I've been using Apache CXF for handling SOAP requests and they feature asychronous http client, which permits having more than one request going out at a time per thread, but this seems to cause an issue where the responses (and in turn the parser) gets thrown around between threads, as a result seemingly crashing due to "malformed" XML exceptions, even though proxy such as BURP and Apache CXF's logging interceptors do confirm that a properly formatted XML response comes back from the service. Question stands: Does Woodstox employ thread safety mechanisms?

Tatu Saloranta

unread,
Sep 27, 2019, 5:26:06 PM9/27/19
to Mantas Gridinas, Woodstox User Mailing List
On Fri, Sep 27, 2019 at 12:38 AM Mantas Gridinas <mgri...@gmail.com> wrote:
Hi!

Lately I've been using Apache CXF for handling SOAP requests and they feature asychronous http client, which permits having more than one request going out at a time per thread, but this seems to cause an issue where the responses (and in turn the parser) gets thrown around between threads, as a result seemingly crashing due to "malformed" XML exceptions, even though proxy such as BURP and Apache CXF's logging interceptors do confirm that a properly formatted XML response comes back from the service. Question stands: Does Woodstox employ thread safety mechanisms?

Parsers/generators should not be accessed concurrently from different threads; access is not synchronized against that, but I don't think this is what you are doing.
Passing parser/generator from one thread to another, without concurrent access, should be fine.

But there is one recent bug, fixed in 6.0.1:


which could have caused problem for accessing parser or generators from different threads, during lifetime of parser/generator. So I would try an upgrade.

Note that despite major version bump, API is fully 5.x compatible (and even 4.x actually).

-+ Tatu +-

 

Mantas Gridinas

unread,
Sep 30, 2019, 10:10:47 AM9/30/19
to Woodstox User Mailing List
Aye, that seems to have helped. I also had to remove apache's dependency on org.codehaus.woodstox:woodstox-core-asl since it also exposed EmptyIterator class which clashed with com.fasterxml.woodstox:woodstox-core EmptyIterator.

Cheers friend.

Tatu Saloranta

unread,
Sep 30, 2019, 12:30:45 PM9/30/19
to Mantas Gridinas, Woodstox User Mailing List
On Mon, Sep 30, 2019 at 7:10 AM Mantas Gridinas <mgri...@gmail.com> wrote:
Aye, that seems to have helped. I also had to remove apache's dependency on

Ok good. It was odd that the problem was not noticed and reported earlier, but better late than never.
 
org.codehaus.woodstox:woodstox-core-asl since it also exposed EmptyIterator class which clashed with com.fasterxml.woodstox:woodstox-core EmptyIterator.

Ah yes. There were issues with removal of that class which unfortunately caused unexpected problems between versions.

-+ Tatu +-
 

Cheers friend.

On Saturday, September 28, 2019 at 12:26:06 AM UTC+3, Tatu Saloranta wrote:
On Fri, Sep 27, 2019 at 12:38 AM Mantas Gridinas <mgri...@gmail.com> wrote:
Hi!

Lately I've been using Apache CXF for handling SOAP requests and they feature asychronous http client, which permits having more than one request going out at a time per thread, but this seems to cause an issue where the responses (and in turn the parser) gets thrown around between threads, as a result seemingly crashing due to "malformed" XML exceptions, even though proxy such as BURP and Apache CXF's logging interceptors do confirm that a properly formatted XML response comes back from the service. Question stands: Does Woodstox employ thread safety mechanisms?

Parsers/generators should not be accessed concurrently from different threads; access is not synchronized against that, but I don't think this is what you are doing.
Passing parser/generator from one thread to another, without concurrent access, should be fine.

But there is one recent bug, fixed in 6.0.1:


which could have caused problem for accessing parser or generators from different threads, during lifetime of parser/generator. So I would try an upgrade.

Note that despite major version bump, API is fully 5.x compatible (and even 4.x actually).

-+ Tatu +-

 

--
You received this message because you are subscribed to the Google Groups "Woodstox User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to woodstox-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/woodstox-user/5c0b0367-e110-434b-9879-6e001cddfc78%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages