SSL session cache lifetime vs session ticket lifetime

Valentin V. Bartenev vbart at nginx.com
Fri Mar 28 19:38:53 UTC 2014


On Thursday 27 March 2014 20:23:15 Maxim Dounin wrote:
> Hello!
> 
> On Wed, Mar 26, 2014 at 01:34:19PM +0400, kyprizel wrote:
> 
> > will be "log_alloc_failures" better?
> 
> I think something like "log_nomem" will be good enough.
> Patch:
> 
> # HG changeset patch
> # User Maxim Dounin <mdounin at mdounin.ru>
> # Date 1395937285 -14400
> #      Thu Mar 27 20:21:25 2014 +0400
> # Node ID 2cc8b9fc7efbf6a98ce29f3f860782a1ebd7e6cf
> # Parent  734f0babfc133c2dc532f2794deadcf9d90245f7
> Core: slab log_nomem flag.
> 
> The flag allows to suppress "ngx_slab_alloc() failed: no memory" messages
> from a slab allocator, e.g., if an LRU expiration is used by a consumer
> and allocation failures aren't fatal.
> 
> The flag is now set in the SSL session cache code, and in the limit_req
> module.
> 
> diff --git a/src/core/ngx_slab.c b/src/core/ngx_slab.c
> --- a/src/core/ngx_slab.c
> +++ b/src/core/ngx_slab.c
> @@ -129,6 +129,7 @@ ngx_slab_init(ngx_slab_pool_t *pool)
>          pool->pages->slab = pages;
>      }
>  
> +    pool->log_nomem = 1;
>      pool->log_ctx = &pool->zero;
>      pool->zero = '\0';
>  }

Just a quick nitpicking.

I'd suggest to put this log_nomem assignment in the last line as to follow
order of elements in the structure definition.

  wbr, Valentin V. Bartenev


[..]
> diff --git a/src/core/ngx_slab.h b/src/core/ngx_slab.h
> --- a/src/core/ngx_slab.h
> +++ b/src/core/ngx_slab.h
> @@ -39,6 +39,8 @@ typedef struct {
>      u_char           *log_ctx;
>      u_char            zero;
>  
> +    unsigned          log_nomem:1;
> +
>      void             *data;
>      void             *addr;
>  } ngx_slab_pool_t;
[..]



More information about the nginx mailing list