Bug 64017 - Apache http server 2.4.41 - Issue with transfer-encoding
Summary: Apache http server 2.4.41 - Issue with transfer-encoding
Status: RESOLVED INVALID
Alias: None
Product: Tomcat Connectors
Classification: Unclassified
Component: mod_jk (show other bugs)
Version: 1.2.46
Hardware: PC Linux
: P1 blocker with 10 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-19 00:15 UTC by Vinoth
Modified: 2020-10-30 10:38 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vinoth 2019-12-19 00:15:09 UTC
We are using apache http server 2.4.41, we came across the issue when tomcat is sending the data as "Transfer-Encoding: chunked" without "Content-Length", apache is splitting the data or dropping the connection when the message body length is more, we tried increasing max_buffer_size nothing helped. Below is the error seen on log file. 

[Tue Dec 17 21:21:09 2019] [63993:140737136023296] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (1409): (node2) wrong message size 18986 8192 from XX.XXX.XX.XXX:XXXX
[Tue Dec 17 21:21:09 2019] [63993:140737136023296] [error] ajp_get_reply::jk_ajp_common.c (2286): (node2) Tomcat is down or network problems. Part of the response has already been sent to the client
[Tue Dec 17 21:21:09 2019] [63993:140737136023296] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (1409): (node2) wrong message size 18986 8192 from XX.XXX.XX.XXX:XXXX
[Tue Dec 17 21:21:09 2019] [63993:140737136023296] [error] ajp_get_reply::jk_ajp_common.c (2286): (node2) Tomcat is down or network problems. Part of the response has already been sent to the client
[Tue Dec 17 21:21:09 2019] [63993:140737136023296] [error] ajp_service::jk_ajp_common.c (2796): (node2) connecting to tomcat failed (rc=-11, errors=1, client_errors=0).

Note: Tomcat is neither down nor network issues is observed. We have been noticing only when response message(json) is exceeding 8k. Is there a workaround for this or any bugs identified in this version?
Comment 1 Rainer Jung 2019-12-19 01:13:42 UTC
The "wrong message size" message shows that Tomcat is configured to use a non-default increased message size and mod_jk still uses the smaller default message size. That won't work.

You should first try with both sides using the default size and post the ligs again of the problem persists. Drop "packetSize" from the AJP connector(s) config in Tomcat's server.xml and max_packet_size from any mod_jk workers configuration.

I will also switch this bug to Tomcat, because mod_jk is provided by the Tomcat project.

Regards,

Rainer
Comment 2 Vinoth 2019-12-19 02:05:33 UTC
Thanks i removed packet size from tomcat and apache. Post that when i try to hit the apache url am getting below error using curl and browser it shows "SyntaxError: JSON.parse: unexpected end of data...." on response tab F12.

Curl Error:

< HTTP/1.1 200 200
HTTP/1.1 200 200
< Date: Thu, 19 Dec 2019 01:56:35 GMT
Date: Thu, 19 Dec 2019 01:56:35 GMT
< Server: Apache/2.4.41 (Unix) mod_jk/1.2.46
Server: Apache/2.4.41 (Unix) mod_jk/1.2.46
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Content-Type: application/json
Content-Type: application/json

<
* Problem (2) in the Chunked-Encoded data
* Closing connection 0
curl: (56) Problem (2) in the Chunked-Encoded data

mod_jk.log:

[Wed Dec 18 20:59:57 2019] [61404:140737068881664] [debug] ajp_process_callback::jk_ajp_common.c (2132): (node2) AJP13 protocol: Reuse is OK
[Wed Dec 18 20:59:57 2019] [61404:140737068881664] [debug] ajp_reset_endpoint::jk_ajp_common.c (848): (node2) resetting endpoint with socket 41
[Wed Dec 18 20:59:57 2019] [61404:140737068881664] [debug] ajp_done::jk_ajp_common.c (3288): recycling connection pool for worker node2 and socket 41
[Wed Dec 18 20:59:57 2019] [61404:140737068881664] [debug] jk_handler::mod_jk.c (2975): Service finished with status=200 
[Wed Dec 18 20:59:57 2019] wizui_router 0.141739


However when i try to hit the direct tomcat url endpoint am getting the proper response back. Looks like apache is splitting the single response to multiple. Please suggest

Thanks,
Vinoth
Comment 3 Rainer Jung 2019-12-19 06:28:18 UTC
Thanks for retrying with default packet sizes.

This should work, because Transfer-Encoding chunked is quite normal. So we seem tl have a specific problem with your setup.

Could you post your mod_jk config, especially workers.properties or similar and your Tomcat version and AJP connector config in server.xml. Plus please also redo once with JkLogLevel trace. Be warned though, that this wil also write the packet contents into the mod_jk log file, so you shouldn't use secret data in theat test. We would also need the mod_jk log file from the restart to the end of the test request/response. If you don't want to POST publicly, you can also send to me directly (rainer.jung@kippdata.de). Plus please also the Apache httpd error log file(s) and everything that is in the Tomcat aor application logs about that request (especially errors and/or exception stacks etc.).

Thanks and regards,

Rainer
Comment 4 Vinoth 2019-12-23 15:34:46 UTC
Hi Rainer,

Did you get a chance to look at it?

Thanks
Comment 5 Vinoth 2019-12-29 21:28:17 UTC
Hi Rainer,


Did you get a chance to look at it?

Thanks
(In reply to Rainer Jung from comment #3)
> Thanks for retrying with default packet sizes.
> 
> This should work, because Transfer-Encoding chunked is quite normal. So we
> seem tl have a specific problem with your setup.
> 
> Could you post your mod_jk config, especially workers.properties or similar
> and your Tomcat version and AJP connector config in server.xml. Plus please
> also redo once with JkLogLevel trace. Be warned though, that this wil also
> write the packet contents into the mod_jk log file, so you shouldn't use
> secret data in theat test. We would also need the mod_jk log file from the
> restart to the end of the test request/response. If you don't want to POST
> publicly, you can also send to me directly (rainer.jung@kippdata.de). Plus
> please also the Apache httpd error log file(s) and everything that is in the
> Tomcat aor application logs about that request (especially errors and/or
> exception stacks etc.).
> 
> Thanks and regards,
> 
> Rainer
Comment 6 Vinoth 2020-01-06 20:09:10 UTC
(In reply to Rainer Jung from comment #3)
> Thanks for retrying with default packet sizes.
> 
> This should work, because Transfer-Encoding chunked is quite normal. So we
> seem tl have a specific problem with your setup.
> 
> Could you post your mod_jk config, especially workers.properties or similar
> and your Tomcat version and AJP connector config in server.xml. Plus please
> also redo once with JkLogLevel trace. Be warned though, that this wil also
> write the packet contents into the mod_jk log file, so you shouldn't use
> secret data in theat test. We would also need the mod_jk log file from the
> restart to the end of the test request/response. If you don't want to POST
> publicly, you can also send to me directly (rainer.jung@kippdata.de). Plus
> please also the Apache httpd error log file(s) and everything that is in the
> Tomcat aor application logs about that request (especially errors and/or
> exception stacks etc.).
> 
> Thanks and regards,
> 
> Rainer

Hi Rainer,

Still waiting for your input.

Thanks
Comment 7 Mark Thomas 2020-01-29 18:17:03 UTC
If you can share the data publicly, more of us can help you. Failing that send it to me (markt@apache.org) and I'll share it with other Tomcat committers who want to investigate this issue.
Comment 8 Michael Osipov 2020-01-29 18:50:05 UTC
Does this work for mod_proxy_http. It received a lot of decent updates recently...
Comment 9 Vinoth 2020-01-30 23:58:45 UTC
(In reply to Mark Thomas from comment #7)
> If you can share the data publicly, more of us can help you. Failing that
> send it to me (markt@apache.org) and I'll share it with other Tomcat
> committers who want to investigate this issue.

Thanks Mark. Was able to identify the issue, looks like has duplicate header on the request 'Transfer Encoding: Chunked' twice. 

"Header unset Transfer-Encoding" on apache fixed the issue. However further digging why duplicate header is being generated.

Thanks
Comment 10 Mark Thomas 2020-01-31 14:34:15 UTC
Thanks for the update. Not a Tomcat issue then so closing.
Comment 11 msms843 2020-10-30 10:38:11 UTC
Hi, this ticket has been resolved as INVALID because it's an httpd issue, but there's no related Apache httpd ticket where I could follow up (or I don't see it).