[BF] wrong value of cache max-size in workers

Maxim Dounin mdounin at mdounin.ru
Wed Jun 15 13:16:52 UTC 2016


Hello!

On Tue, Jun 14, 2016 at 04:50:19PM +0200, Sergey Brester wrote:

> Hi,
> 
> enclosed you'll find a changeset with fix for wrong max_size in http file
> cache:
> 
> max_size still in bytes in child workers, because cache init called in
> master (and cache->max_size does not corrected from child if already exists,
> and it is not in shared mem),
> so this large size will be "never" reached, in such comparisons like `if
> (size < cache->max_size) ...`.

Thanks, looks like a valid win32-related problem.  See below for 
comments about the patch.

> # HG changeset patch
> # User Serg G. Brester (sebres) <serg.brester at sebres.de>
> # Date 1465913777 -7200
> #      Tue Jun 14 16:16:17 2016 +0200
> # Node ID b430e4546172af42bcecf0fc289ec45ef5f9e865
> # Parent  1064ea81ed3aabb8ad422ffcc60ddcde667022ac
> fix for http file cache: max_size still in bytes in child workers,
> because cache init called in master, so this large size will be "never" reached

As this is a win32-only problem, please clearly describe this in 
commit log.  E.g., use "Win32: " prefix in the summary line.  
Please also describe that this is win32-specific.  Alternatively, 
please use "Cache: " prefix.  Also, please use full sentences, 
including dots.

More hints can be found here:
http://nginx.org/en/docs/contributing_changes.html

> diff -r 1064ea81ed3a -r b430e4546172 src/http/ngx_http_file_cache.c
> --- a/src/http/ngx_http_file_cache.c	Thu Jun 09 16:55:38 2016 +0300
> +++ b/src/http/ngx_http_file_cache.c	Tue Jun 14 16:16:17 2016 +0200
> @@ -130,6 +130,8 @@ ngx_http_file_cache_init(ngx_shm_zone_t 
>          cache->sh = cache->shpool->data;
>          cache->bsize = ngx_fs_bsize(cache->path->name.data);
>  

This empty line looks unneded for me.  YMMV.

> +        cache->max_size /= cache->bsize;
> +
>          return NGX_OK;
>      }
>  

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx-devel mailing list