Welcome! Log In Create A New Profile

Advanced

http2 request log in accurate $request_time ?

January 22, 2020 10:38AM
nginx version: nginx-1.9.5


hi,nginx compute $request_time in log phase, which is in

ngx_http_free_request (r) -> ngx_http_log_request(r) -> log_handler(r)


but in http2 world, I see every request closed through ngx_http_v2_close_stream(stream, rc)

in ngx_http_v2_close_stream have code below:


```
void
ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc)
{
ngx_event_t *ev;
ngx_connection_t *fc;
ngx_http_v2_node_t *node;
ngx_http_v2_connection_t *h2c;

h2c = stream->connection;
node = stream->node;

ngx_log_debug3(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
"http2 close stream %ui, queued %ui, processing %ui",
node->id, stream->queued, h2c->processing);

fc = stream->request->connection;

if (stream->queued) {
fc->write->handler = ngx_http_v2_close_stream_handler;
return;
}

if (!stream->out_closed) {
if (ngx_http_v2_send_rst_stream(h2c, node->id,
NGX_HTTP_V2_INTERNAL_ERROR)
!= NGX_OK)
{
h2c->connection->error = 1;
}
}

node->stream = NULL;

ngx_queue_insert_tail(&h2c->closed, &node->reuse);
h2c->closed_nodes++;

ngx_http_free_request(stream->request, rc);
xxx
}
```
if stream->queued is true, then ngx_http_free_request will not be called immediately, which will result $request_time larger then real request time?


any body can affirm this ?
Subject Author Posted

http2 request log in accurate $request_time ?

xt3627216 January 22, 2020 10:38AM

Re: http2 request log in accurate $request_time ?

xt3627216 January 22, 2020 10:41AM

Re: http2 request log in accurate $request_time ?

J.R. January 22, 2020 11:00AM

Re: http2 request log in accurate $request_time ?

Maxim Dounin January 22, 2020 12:46PM

Re: http2 request log in accurate $request_time ?

xt3627216 January 23, 2020 01:37AM

Re: http2 request log in accurate $request_time ?

Maxim Dounin January 23, 2020 07:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 277
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready