Mercurial > hg > nginx
annotate auto/cc/clang @ 6412:4ba91a4c66a3
HTTP/2: implemented per request timeouts (closes #626).
Previously, there were only three timeouts used globally for the whole HTTP/2
connection:
1. Idle timeout for inactivity when there are no streams in processing
(the "http2_idle_timeout" directive);
2. Receive timeout for incomplete frames when there are no streams in
processing (the "http2_recv_timeout" directive);
3. Send timeout when there are frames waiting in the output queue
(the "send_timeout" directive on a server level).
Reaching one of these timeouts leads to HTTP/2 connection close.
This left a number of scenarios when a connection can get stuck without any
processing and timeouts:
1. A client has sent the headers block partially so nginx starts processing
a new stream but cannot continue without the rest of HEADERS and/or
CONTINUATION frames;
2. When nginx waits for the request body;
3. All streams are stuck on exhausted connection or stream windows.
The first idea that was rejected was to detect when the whole connection
gets stuck because of these situations and set the global receive timeout.
The disadvantage of such approach would be inconsistent behaviour in some
typical use cases. For example, if a user never replies to the browser's
question about where to save the downloaded file, the stream will be
eventually closed by a timeout. On the other hand, this will not happen
if there's some activity in other concurrent streams.
Now almost all the request timeouts work like in HTTP/1.x connections, so
the "client_header_timeout", "client_body_timeout", and "send_timeout" are
respected. These timeouts close the request.
The global timeouts work as before.
Previously, the c->write->delayed flag was abused to avoid setting timeouts on
stream events. Now, the "active" and "ready" flags are manipulated instead to
control the processing of individual streams.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 24 Feb 2016 15:58:07 +0300 |
parents | 80bd391c90d1 |
children | 9eefb38f0005 |
rev | line source |
---|---|
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
1 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
2 # Copyright (C) Nginx, Inc. |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
3 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
4 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
5 # clang |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
6 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 |
5187
f1daa0356a1d
Configure: fixed detection of newer Apple clang compilers.
Ruslan Ermilov <ru@nginx.com>
parents:
4762
diff
changeset
|
8 NGX_CLANG_VER=`$CC -v 2>&1 | grep '\(clang\|LLVM\) version' 2>&1 \ |
f1daa0356a1d
Configure: fixed detection of newer Apple clang compilers.
Ruslan Ermilov <ru@nginx.com>
parents:
4762
diff
changeset
|
9 | sed -e 's/^.* version \(.*\)/\1/'` |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
10 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
11 echo " + clang version: $NGX_CLANG_VER" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 CC_TEST_FLAGS="-pipe" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
17 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
18 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 # optimizations |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 #NGX_CLANG_OPT="-O2" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 #NGX_CLANG_OPT="-Oz" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 NGX_CLANG_OPT="-O" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
24 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
25 case $CPU in |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 pentium) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 # optimize for Pentium |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
28 CPU_OPT="-march=pentium" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 NGX_CPU_CACHE_LINE=32 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
31 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
32 pentiumpro | pentium3) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 # optimize for Pentium Pro, Pentium II and Pentium III |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 CPU_OPT="-march=pentiumpro" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 NGX_CPU_CACHE_LINE=32 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
36 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
37 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
38 pentium4) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
39 # optimize for Pentium 4 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
40 CPU_OPT="-march=pentium4" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 NGX_CPU_CACHE_LINE=128 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
43 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 athlon) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 # optimize for Athlon |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 CPU_OPT="-march=athlon" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
47 NGX_CPU_CACHE_LINE=64 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
50 opteron) |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
51 # optimize for Opteron |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
52 CPU_OPT="-march=opteron" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 NGX_CPU_CACHE_LINE=64 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
54 ;; |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 esac |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
58 CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 CFLAGS="$CFLAGS -pipe $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
63 if [ ".$PCRE_OPT" = "." ]; then |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
64 PCRE_OPT="-O2 -pipe $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
65 else |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
66 PCRE_OPT="$PCRE_OPT -pipe" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
67 fi |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
68 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
69 if [ ".$MD5_OPT" = "." ]; then |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
70 MD5_OPT="-O2 -pipe $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
71 else |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 MD5_OPT="$MD5_OPT -pipe" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 fi |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
74 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 if [ ".$ZLIB_OPT" = "." ]; then |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 ZLIB_OPT="-O2 -pipe $CPU_OPT" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
77 else |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
78 ZLIB_OPT="$ZLIB_OPT -pipe" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 fi |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
80 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 # warnings |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith" |
5459
fedf777c6b24
Configure: enable -Wconditional-uninitialized with clang.
Ruslan Ermilov <ru@nginx.com>
parents:
5187
diff
changeset
|
85 CFLAGS="$CFLAGS -Wconditional-uninitialized" |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
86 #CFLAGS="$CFLAGS -Wmissing-prototypes" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
87 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
88 # we have a lot of unused function arguments |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
89 CFLAGS="$CFLAGS -Wno-unused-parameter" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
90 |
5714
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
91 # deprecated system OpenSSL library on OS X |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
92 if [ "$NGX_SYSTEM" = "Darwin" ]; then |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
93 CFLAGS="$CFLAGS -Wno-deprecated-declarations" |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
94 fi |
80bd391c90d1
Configure: added -Wno-deprecated-declarations on OS X.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5539
diff
changeset
|
95 |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
96 # stop on warning |
5539
c86dd32573c0
Configure: enabled -Werror for clang.
Ruslan Ermilov <ru@nginx.com>
parents:
5459
diff
changeset
|
97 CFLAGS="$CFLAGS -Werror" |
4762
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
98 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
99 # debug |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
100 CFLAGS="$CFLAGS -g" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
101 |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
102 if [ ".$CPP" = "." ]; then |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
103 CPP="$CC -E" |
182aee3b1bf5
Added the Clang compiler support.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
104 fi |