Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: ngx_post_event() instead of upgraded call (tic...

Maxim Dounin
February 18, 2014 09:28AM
details: http://hg.nginx.org/nginx/rev/7586e7b2dbe9
branches:
changeset: 5579:7586e7b2dbe9
user: Maxim Dounin <mdounin@mdounin.ru>
date: Tue Feb 18 17:30:40 2014 +0400
description:
Upstream: ngx_post_event() instead of upgraded call (ticket #503).

If a request is finalized in the first call to the
ngx_http_upstream_process_upgraded() function, e.g., because upstream
server closed the connection for some reason, in the second call
the u->peer.connection pointer will be null, resulting in segmentation
fault.

Fix is to avoid second direct call, and post event instead. This ensures
that ngx_http_upstream_process_upgraded() won't be called again if
a request is finalized.

diffstat:

src/http/ngx_http_upstream.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diffs (13 lines):

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2557,7 +2557,9 @@ ngx_http_upstream_upgrade(ngx_http_reque
if (u->peer.connection->read->ready
|| u->buffer.pos != u->buffer.last)
{
+ ngx_post_event(c->read, &ngx_posted_events);
ngx_http_upstream_process_upgraded(r, 1, 1);
+ return;
}

ngx_http_upstream_process_upgraded(r, 0, 1);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: ngx_post_event() instead of upgraded call (tic...

Maxim Dounin 768 February 18, 2014 09:28AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 173
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