openresty / memc-nginx-module

An extended version of the standard memcached module that supports set, add, delete, and many more memcached commands.
http://wiki.nginx.org/NginxHttpMemcModule
213 stars 56 forks source link

fix client abort while cache storing for too fast disconnecting clients #13

Closed kyprizel closed 10 years ago

kyprizel commented 10 years ago

Fix: If client disconnects too fast (small response body), upstream connection also closes and response will not be cached.

agentzh commented 10 years ago

@kyprizel This could be a real issue but your patch looks wrong to me :)

I think the real issue is in ngx_memc or ngx_redis2, which both do not ignore client aborts by explicitly setting conf->upstream.ignore_client_abort = 0. Will you submit patches to these modules and add new directives memc_ignore_client_abort and redis2_ignore_client_abort? Just like ngx_proxy's proxy_ignore_client_abort directive:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ignore_client_abort

Thanks!

kyprizel commented 10 years ago

I think in some cases (fetching the cache) we do not need to continue if the client was disconnected.

agentzh commented 10 years ago

@kyprizel Easy. Just configure two separate (internal) locations for srcache_fetch and srcache_store, respectively. Put memc_ignore_client_abort off in the former location and memc_ignore_client_abort on in the latter :)

kyprizel commented 10 years ago

Yep :) You're right, will send request later.