hi,
i understand that NGX_AGAIN is returned when a chain could not be send
because more data cannot be buffered on that socket.
I need to understand the following: in my case, when i receive a request, i
start a timer every 10ms and send out some data, then i create a new timer
every10ms until i decide to finish sending out data (video frames).
But if in some triggered callback by the timer the
ngx_http_output_filter(..) returns NGX_AGAIN *i assume* NginX will send
that chain as soon as the socket becomes available again. But after that
happens, how can i restore my timer cycle ?
thnks.
J.Z.
Hello!
Akos Gyimesi reported a request hang (downstream connections stuck in
the CLOSE_WAIT state forever) regarding use of proxy_cache_lock in
subrequests.
The issue is that when proxy_cache_lock_timeout is reached,
ngx_http_file_cache_lock_wait_handler calls
r->connection->write->handler() directly, but
r->connection->write->handler is (usually) just
ngx_http_request_handler, which simply picks up r->connection->data,
which is *not* necessarily the current (sub)request, so the current
subrequest may never be continued nor finalized, leading to an
infinite request hang.
The following patch fixes this issue for me. Comments welcome!
Thanks!
-agentzh
--- nginx-1.4.3/src/http/ngx_http_file_cache.c 2013-10-08
05:07:14.000000000 -0700
+++ nginx-1.4.3-patched/src/http/ngx_http_file_cache.c 2013-10-26
14:47:56.184041728 -0700
@@ -432,6 +432,7 @@ ngx_http_file_cache_lock_wait_handler(ng
ngx_uint_t wait;
ngx_msec_t timer;
ngx_http_cache_t *c;
+ ngx_connection_t *conn;
ngx_http_request_t *r;
ngx_http_file_cache_t *cache;
@@ -471,7 +472,10 @@ wakeup:
c->waiting = 0;
r->main->blocked--;
- r->connection->write->handler(r->connection->write);
+
+ conn = r->connection;
+ r->write_event_handler(r);
+ ngx_http_run_posted_requests(conn);
}
At present, alloting memory with size of ngx_slab_max_size causes
1) an internal fragmentation, size of ngx_slab_max_size, comes into being
2) the slot with index of (ngx_pagesize_shift - pool->min_shift - 1)
is the right slot for this size.
# HG changeset patch
# User Jianjun Zheng <codeeply(a)gmail.com>
# Date 1403080799 -28800
# Wed Jun 18 16:39:59 2014 +0800
# Node ID 1704335dd810e2e2abb2b393b4f7b7c9004c6012
# Parent ec919574cc14f7781c0ca212cffec586f88eec40
Core: bugfix for the ngx_slab_max_size case
diff -r ec919574cc14 -r 1704335dd810 src/core/ngx_slab.c
--- a/src/core/ngx_slab.c Tue Jun 17 16:51:25 2014 +0400
+++ b/src/core/ngx_slab.c Wed Jun 18 16:39:59 2014 +0800
@@ -160,7 +160,7 @@
ngx_uint_t i, slot, shift, map;
ngx_slab_page_t *page, *prev, *slots;
- if (size >= ngx_slab_max_size) {
+ if (size > ngx_slab_max_size) {
ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0,
"slab alloc: %uz", size);
Hello,
This patch removes some redundant ngx_http_request_body_filter calls,
simplifies the ngx_http_do_read_client_request_body and
ngx_http_read_client_request_body functions and removes some
duplication of code.
body.t and body_chunked.t test in nginx-tests are passing.
Please kindly consider it.
Thank you.
HI All,
I am working as C/C++ developer for a company which makes nginx modules and
would like to know if I can contribute a bit.
Kind regards.
David CARLIER
dotMobi / Afilias Technologies DUBLIN
# HG changeset patch
# User Piotr Sikora <piotr(a)cloudflare.com>
# Date 1403851163 25200
# Thu Jun 26 23:39:23 2014 -0700
# Node ID 177382006b7d7a421688831d5793b2e417074b48
# Parent 42114bf12da0cf3d428d0e695139f5366cbd0513
Core: use uppercase hexadecimal digits for percent-encoding.
RFC3986 says that, for consistency, URI producers and normalizers
should use uppercase hexadecimal digits for all percent-encodings.
This is also what modern web browsers and other tools use.
Using lowercase hexadecimal digits makes it harder to interact with
those tools in case when use of the percent-encoded URI is required,
for example when $request_uri is part of the cache key.
Signed-off-by: Piotr Sikora <piotr(a)cloudflare.com>
diff -r 42114bf12da0 -r 177382006b7d src/core/ngx_string.c
--- a/src/core/ngx_string.c Mon Jun 16 19:43:25 2014 +0400
+++ b/src/core/ngx_string.c Thu Jun 26 23:39:23 2014 -0700
@@ -1407,7 +1407,7 @@ ngx_escape_uri(u_char *dst, u_char *src,
{
ngx_uint_t n;
uint32_t *escape;
- static u_char hex[] = "0123456789abcdef";
+ static u_char hex[] = "0123456789ABCDEF";
/* " ", "#", "%", "?", %00-%1F, %7F-%FF */