You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The nginx connection hangs until timeout for the following nginx configuration:
header_filter_type 'java';
header_filter_name 'MyHeaderFilter'
proxy_http_version 1.1;
proxy_buffering off;
Note the curl output in verbose mode shows:
Transfer-Encoding: chunked
It works fine if I remove the header filter.
It also works fine if I make any of the following changes:
change proxy_buffering to on
change proxy_http_version to 1.0
set Content-Length in response header
Note if I change proxy_http_version to 1.0 or set Content-Length in response header, the transfer encoding is no longer trunked. I am not sure this is related to the hanging issue. Even with trunked transfer encoding, it works fine if I change proxy_buffering to on.
For testing purpose, my filter class is simply:
public class MyFilter implements NginxJavaHeaderFilter { @OverRide
public Object[] doFilter(int status, Map<String, Object> request, Map<String, Object> responseHeaders) throws IOException {
return Constants.PHASE_DONE;
}
}
My nginx version is 1.12.2 and my nginx-closure version is 0.4.5. You should be able to reproduce the issue easily.
This is a blocking issue for me as my customers use the above configuration for streaming large amount of data. Thanks for your help!
Jason
The text was updated successfully, but these errors were encountered:
mengzheng
changed the title
nginx connection hangs with a NginxJavaHeaderFilter
nginx connection hangs with a NginxJavaHeaderFilter when proxy_buffering is off
Apr 24, 2018
@xfeep It worked. This is probably the best workaround. Thanks!
A few questions:
I use nginx as reverse proxy in front of the Rest Service. I am not familiar with Coroutines support. If I cannot use thread pool with proxy buffering off, can I use coroutines support instead to handle slow I/O operations? Does "proxy_buffering off" work well with coroutines support?
The service sends stream data to the client with chunked Transfer-Encoding. I noticed that the header filter is only called once. It is called per request, not per chunk. Is that expected behavior?
Assume the service streams the data to the client over a period of time. When the filter is invoked, the status is 200. But the streaming fails and exits after some time and sets status to 500. How can the header filter be invoked again with 500 status?
The nginx connection hangs until timeout for the following nginx configuration:
header_filter_type 'java';
header_filter_name 'MyHeaderFilter'
proxy_http_version 1.1;
proxy_buffering off;
Note the curl output in verbose mode shows:
It works fine if I remove the header filter.
It also works fine if I make any of the following changes:
Note if I change proxy_http_version to 1.0 or set Content-Length in response header, the transfer encoding is no longer trunked. I am not sure this is related to the hanging issue. Even with trunked transfer encoding, it works fine if I change proxy_buffering to on.
For testing purpose, my filter class is simply:
public class MyFilter implements NginxJavaHeaderFilter {
@OverRide
public Object[] doFilter(int status, Map<String, Object> request, Map<String, Object> responseHeaders) throws IOException {
return Constants.PHASE_DONE;
}
}
My nginx version is 1.12.2 and my nginx-closure version is 0.4.5. You should be able to reproduce the issue easily.
This is a blocking issue for me as my customers use the above configuration for streaming large amount of data. Thanks for your help!
Jason
The text was updated successfully, but these errors were encountered: