Mercurial > hg > nginx
comparison src/event/ngx_event_openssl.c @ 8075:38c71f9b2293
SSL: reduced logging of session cache failures (ticket #621).
Session cache allocations might fail as long as the new session is different
in size from the one least recently used (and freed when the first allocation
fails). In particular, it might not be possible to allocate space for
sessions with client certificates, since they are noticeably bigger than
normal sessions.
To ensure such allocation failures won't clutter logs, logging level changed
to "warn", and logging is now limited to at most one warning per second.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Wed, 12 Oct 2022 20:14:36 +0300 |
parents | 026ee23b6774 |
children | fa4b4f38da4a |
comparison
equal
deleted
inserted
replaced
8074:026ee23b6774 | 8075:38c71f9b2293 |
---|---|
3768 ngx_rbtree_init(&cache->session_rbtree, &cache->sentinel, | 3768 ngx_rbtree_init(&cache->session_rbtree, &cache->sentinel, |
3769 ngx_ssl_session_rbtree_insert_value); | 3769 ngx_ssl_session_rbtree_insert_value); |
3770 | 3770 |
3771 ngx_queue_init(&cache->expire_queue); | 3771 ngx_queue_init(&cache->expire_queue); |
3772 | 3772 |
3773 cache->fail_time = 0; | |
3774 | |
3773 len = sizeof(" in SSL session shared cache \"\"") + shm_zone->shm.name.len; | 3775 len = sizeof(" in SSL session shared cache \"\"") + shm_zone->shm.name.len; |
3774 | 3776 |
3775 shpool->log_ctx = ngx_slab_alloc(shpool, len); | 3777 shpool->log_ctx = ngx_slab_alloc(shpool, len); |
3776 if (shpool->log_ctx == NULL) { | 3778 if (shpool->log_ctx == NULL) { |
3777 return NGX_ERROR; | 3779 return NGX_ERROR; |
3951 ngx_slab_free_locked(shpool, sess_id); | 3953 ngx_slab_free_locked(shpool, sess_id); |
3952 } | 3954 } |
3953 | 3955 |
3954 ngx_shmtx_unlock(&shpool->mutex); | 3956 ngx_shmtx_unlock(&shpool->mutex); |
3955 | 3957 |
3956 ngx_log_error(NGX_LOG_ALERT, c->log, 0, | 3958 if (cache->fail_time != ngx_time()) { |
3957 "could not allocate new session%s", shpool->log_ctx); | 3959 cache->fail_time = ngx_time(); |
3960 ngx_log_error(NGX_LOG_WARN, c->log, 0, | |
3961 "could not allocate new session%s", shpool->log_ctx); | |
3962 } | |
3958 | 3963 |
3959 return 0; | 3964 return 0; |
3960 } | 3965 } |
3961 | 3966 |
3962 | 3967 |