Hi Chris,
A follow-up. I found the following discussion, which goes back to October 19,
2011:
http://tomcat.10.x6.nabble.com/Reuse-mod-ajp-proxy-connections-td2096715.html
I think it is relevant to this issue. Back then, one Dimitar said:
>> "My understanding of the *reuse* flag in AJP13_END_RESPONSE
>> structure is that this flag is hard coded and cannot be controlled
>> by configuration settings. I couldn't find any in Tomcat AJP
>> connector configuration that could do that."
You responded with:
>> "I'm no expert, but seeing keepalives disabled for a proxy connection
>> would sure make me think that maybe that setting is disabling, ya
>> know, the keepalive-style connection that AJP is supposed to maintain.
>>... I'd try NOT disabling keepalives and see if that helps."
In our set-up, the settings for socket_keepalive is false by default. So, we're
now going to add the line
worker.workerName.socket_keepalive=true
to the workers.properties file and see what happens.
Kind regards,
Alfred
-Oorspronkelijk bericht-
Van: Alfred Bakia
Verzonden: 17 June 2020 19:08
Aan: Tomcat Users List
Onderwerp: RE: Warning "AJP13 protocol: Reuse is set to false" written logs
every second of every day. Please help.
Hi Chris,
Thanks for your reply. Thanks also for your warning against interfering with
the setting allowedRequestAttributesPattern ('Setting the value to ".*" is a
violation of sane security policy'). I guessed as much, and am grateful for
your confirmation.
On the subject of mod_jk, we are apparently talking about the same thing. In
our set-up the mod_jk log is called isapi_redirect.log.
The code that generates the error is indeed /native/common/jk_ajp_common.c. The
part where the error is generated is:
case JK_AJP13_END_RESPONSE:
ae->reuse = (int)jk_b_get_byte(msg);
if (!ae->reuse) {
/*
* AJP13 protocol reuse flag set to false.
* Tomcat will close its side of the connection.
*/
jk_log(l, JK_LOG_WARNING, "(%s) AJP13 protocol: Reuse is set to false",
ae->worker->name);
}
This code snippet says that reuse is determined - at the end of a response -
from a byte obtained from some message. Which raises two questions:
1) The response to the "ping" REST request has status code 204 ("No Content").
If, as you say, a 204 response is OK, then where would the reuse byte come from?
2) Do you know a way to set the "AJP13 protocol reuse flag" to true? As far as
we know, the only "reuse" settings at our disposal are the current worker
settings, worker.workerName.connection_pool_size=500
and worker. workerName.max_reuse_connections=250.
Kind regards,
Alfred
-Oorspronkelijk bericht-
Van: Christopher Schultz
Verzonden: 16 June 2020 19:55
Aan: Tomcat Users List
Onderwerp: Re: Warning "AJP13 protocol: Reuse is set to false" written logs
every second of every day. Please help.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256
Alfred,
On 6/15/20 09:45, Alfred Bakia wrote:
> Thanks, Chris. To respond to your remarks:
>
> 1) The warnings, "AJP13 protocol: Reuse is set to false", are being
logged by Tomcat (in the Tomcat AJP connector logs).
Weird. I can't find that string anywhere in code or other files in Tomcat, but
its right there in mod_jk:
./native/common/jk_ajp_common.c:jk_log(l, JK_LOG_WARNING,
"(%s) AJP13 protocol: Reuse is set to false",
Are you sure you are looking at the right log file?
> 2) As I mentioned earlier, the versions and settings of the servers
> (and their respective IIS web servers) are the same.
>
> In any case I have discovered "how" the warning occurs. It is indeed
> triggered by the REST API.
>
> The culprit is a REST request in the form:
>
> http://www.ourdomain.com/api/srv2/exercises/93/1431/26346/ping
>
> It is a POST request and "ping" is a custom REST method. It is just a
> ping, so the status code of the response is 204 ("No Content").
A 204 response should not cause any problem.
> I can confirm that every ping request results in the warning
> "AJP13 protocol: Reuse is set to false" being written to Tomcat's
> connector logs.
>
> Researching this on the web, I found the suggestion to add
> allowedRequestAttributesPattern=".*" to the AJP connector in
> server.xml.
>
> Is this a viable solution?
This has nothing to do with your REST API. This is a change made to recent
versions of Tomcat that may require you to allow certain non-standard variables
to be passed-over from your web server to Tomcat via AJP.
If your "ping" REST API is requiring some information to be passed from the web
server to Tomcat and you are seeing errors on the Tomcat side, then you may
have to fiddle with the allowedRequestAttributesPattern. Setting the value to
".*" is a violation of sane security policy.
But I see no evidence that your "Reuse is set to false" error is related (yet)
to the allowedRequestAttributesPattern. If you see errors in the Tomcat log,
please post them and we'll see.
The allowedRequest