question about ngx_ssl_clear_error()

何龙 lh2008999 at gmail.com
Wed Jan 28 14:06:31 UTC 2015


sorry i make a mistake.  the nginx code  is correct.

int the loop ,  ngx_ssl_error() called ERR_get_error(), which will pop
error queue head element.


2015-01-28 21:58 GMT+08:00 何龙 <lh2008999 at gmail.com>:
> in src/event/ngx_event_openssl.c:1907, i found function
> ngx_ssl_clear_error() call openssl function ERR_peek_error() in a
> while loop, intend to clear global error code queue,
>
> but according to openssl's documents and source code, ERR_peek_error() will not
> pop the first error code , and  it does not modify the queue.
>
> so it looks like this will cause a busy loop.
>
> is my understanding correct?
>
> reference:
>
> nginx source code
> "
> static void
> ngx_ssl_clear_error(ngx_log_t *log)
> {
>     while (ERR_peek_error()) {
>         ngx_ssl_error(NGX_LOG_ALERT, log, 0, "ignoring stale global SSL error");
>     }
>
>     ERR_clear_error();
> }
>
> "
>
> openssl source code:
> https://github.com/openssl/openssl/blob/master/crypto/err/err.c#L770



More information about the nginx-devel mailing list