openresty / openresty/srcache-nginx-module
srcache_fetch stucked while processing some requests
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 486
- Forks
- 101
- Avg merge
- 1h 28m
- Merged PRs (30d)
- 2
Description
Hello, i get very strange trouble with directive "srcache_fetch" and some kind of SOAP requests.
When i send some POST requests from SOAP UI or another app with User-Agent like "HTTP/Apache (java)" to Openresty, some requests processed well: sending GET request to memc_pass, then store cache, go to proxy_pass and send responds to client.
But other requests are stuck after response from memcached server and wait till client closes connection by it's own timeout (that can be much more than memc_read timeout).
BTW, when i send SOAP request with same body by CURL, i can't reproduce this problem - all requests processed well.
openresty version: 1.11.2.5
nginx version: nginx/1.10.2
This is depersonalized part of my nginx.conf^
location = /memc {
internal;
memc_connect_timeout 100ms;
memc_send_timeout 100ms;
memc_read_timeout 100ms;
memc_ignore_client_abort off;
set $memc_key $query_string;
set $memc_exptime 3600;
memc_pass memcached-ip-addr:memcached-port;
}
location /memc-stats {
add_header Content-Type text/plain;
set $memc_cmd stats;
memc_pass memcached-ip-addr:memcached-port;
}
location /location-name {
access_log logs/access.log main;
set $responsebody "0";
set $reqbody "0";
set $key "0";
lua_need_request_body on;
client_max_body_size 50M;
rewrite_by_lua '
local method = ngx.var.request_method
if method == "POST" then
ngx.req.read_body()
local data = ngx.req.get_body_data()
ngx.var.reqbody = data
elseif method == "GET" then
local data = ngx.var.query_string
ngx.var.reqbody = data
end
ngx.var.key = ngx.md5(ngx.var.reqbody)
return ngx.var.key
';
srcache_request_cache_control off;
srcache_response_cache_control off;
srcache_ignore_content_encoding on;
srcache_store_private on;
srcache_fetch GET /memc $key;
srcache_store_statuses 200 201 301 302;
srcache_store PUT /memc $key;
srcache_methods GET POST;
proxy_pass http://proxy-pass-addr;
proxy_buffering off;
proxy_connect_timeout 5s;
proxy_send_timeout 5s;
proxy_read_timeout 30s;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the issue's nginx.conf, especially the srcache_fetch GET /memc flow, the /memc location, and rewrite_by_lua request-body handling. Reproduce the SOAP UI or HTTP/Apache (java) request and compare it with the equivalent CURL request, using the reported OpenResty and nginx versions. Done means the affected requests complete instead of waiting for the client timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, lua, memcached, nginx
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100