Mercurial > hg > nginx-quic
annotate auto/feature @ 6440:248aa2757332
Fixed timeouts with threaded sendfile() and subrequests.
If a write event happens after sendfile() but before we've got the
sendfile results in the main thread, this write event will be ignored.
And if no more events will happen, the connection will hang.
Removing the events works in the simple cases, but not always, as
in some cases events are added back by an unrelated code. E.g.,
the upstream module adds write event in the ngx_http_upstream_init()
to track client aborts.
Fix is to use wev->complete instead. It is now set to 0 before
a sendfile() task is posted, and it is set to 1 once a write event
happens. If on completion of the sendfile() task wev->complete is 1,
we know that an event happened while we were executing sendfile(), and
the socket is still ready for writing even if sendfile() did not sent
all the data or returned EAGAIN.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 18 Mar 2016 05:04:45 +0300 |
parents | 434548349838 |
children | e3faa5fb7772 |
rev | line source |
---|---|
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
1 |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
2 # Copyright (C) Igor Sysoev |
4412 | 3 # Copyright (C) Nginx, Inc. |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
358
diff
changeset
|
4 |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
455 | 6 echo $ngx_n "checking for $ngx_feature ...$ngx_c" |
7 | |
8 cat << END >> $NGX_AUTOCONF_ERR | |
9 | |
10 ---------------------------------------- | |
11 checking for $ngx_feature | |
12 | |
13 END | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
14 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 ngx_found=no |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 |
455 | 17 if test -n "$ngx_feature_name"; then |
645 | 18 ngx_have_feature=`echo $ngx_feature_name \ |
19 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ` | |
455 | 20 fi |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
22 if test -n "$ngx_feature_path"; then |
2139 | 23 for ngx_temp in $ngx_feature_path; do |
24 ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp" | |
25 done | |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
26 fi |
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
27 |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 cat << END > $NGX_AUTOTEST.c |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
30 #include <sys/types.h> |
455 | 31 $NGX_INCLUDE_UNISTD_H |
32 $ngx_feature_incs | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
33 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
34 int main() { |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
35 $ngx_feature_test; |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 return 0; |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 } |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 END |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 |
455 | 41 |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
42 ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \ |
3367
568a854383f9
test invalid --with-ld-opt in right place
Igor Sysoev <igor@sysoev.ru>
parents:
2139
diff
changeset
|
43 -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs" |
461 | 44 |
875
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
45 ngx_feature_inc_path= |
7af8276b1c2f
test PCRE in FreeBSD, Linux, and NetBSD
Igor Sysoev <igor@sysoev.ru>
parents:
705
diff
changeset
|
46 |
946 | 47 eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1" |
455 | 48 |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
49 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 if [ -x $NGX_AUTOTEST ]; then |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
51 |
619 | 52 case "$ngx_feature_run" in |
53 | |
54 yes) | |
702
67deba330372
auto/configure [ PAUSE ] hwcap bug
Igor Sysoev <igor@sysoev.ru>
parents:
645
diff
changeset
|
55 # /bin/sh is used to intercept "Killed" or "Abort trap" messages |
3916
0ec738f18346
log "Abort trap" or similar messages
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
56 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then |
619 | 57 echo " found" |
58 ngx_found=yes | |
455 | 59 |
619 | 60 if test -n "$ngx_feature_name"; then |
61 have=$ngx_have_feature . auto/have | |
62 fi | |
455 | 63 |
619 | 64 else |
65 echo " found but is not working" | |
66 fi | |
67 ;; | |
68 | |
3787
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
69 value) |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
70 # /bin/sh is used to intercept "Killed" or "Abort trap" messages |
3916
0ec738f18346
log "Abort trap" or similar messages
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
71 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then |
3787
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
72 echo " found" |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
73 ngx_found=yes |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
74 |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
75 cat << END >> $NGX_AUTO_CONFIG_H |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
76 |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
77 #ifndef $ngx_feature_name |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
78 #define $ngx_feature_name `$NGX_AUTOTEST` |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
79 #endif |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
80 |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
81 END |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
82 else |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
83 echo " found but is not working" |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
84 fi |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
85 ;; |
e294f37401c0
use copied strerror() messages and autoconfigured sys_nerr value
Igor Sysoev <igor@sysoev.ru>
parents:
3367
diff
changeset
|
86 |
619 | 87 bug) |
702
67deba330372
auto/configure [ PAUSE ] hwcap bug
Igor Sysoev <igor@sysoev.ru>
parents:
645
diff
changeset
|
88 # /bin/sh is used to intercept "Killed" or "Abort trap" messages |
3916
0ec738f18346
log "Abort trap" or similar messages
Igor Sysoev <igor@sysoev.ru>
parents:
3787
diff
changeset
|
89 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then |
619 | 90 echo " not found" |
455 | 91 |
619 | 92 else |
93 echo " found" | |
94 ngx_found=yes | |
95 | |
96 if test -n "$ngx_feature_name"; then | |
97 have=$ngx_have_feature . auto/have | |
98 fi | |
99 fi | |
100 ;; | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
101 |
619 | 102 *) |
103 echo " found" | |
104 ngx_found=yes | |
455 | 105 |
619 | 106 if test -n "$ngx_feature_name"; then |
107 have=$ngx_have_feature . auto/have | |
108 fi | |
109 ;; | |
455 | 110 |
619 | 111 esac |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
112 |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
113 else |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
114 echo " not found" |
455 | 115 |
116 echo "----------" >> $NGX_AUTOCONF_ERR | |
117 cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR | |
118 echo "----------" >> $NGX_AUTOCONF_ERR | |
119 echo $ngx_test >> $NGX_AUTOCONF_ERR | |
120 echo "----------" >> $NGX_AUTOCONF_ERR | |
358
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
121 fi |
0a03c921c81d
nginx-0.0.7-2004-06-17-21:18:53 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
122 |
5309
434548349838
Configure: fixed autotest cleanup commands.
Sergey Kandaurov <pluknet@nginx.com>
parents:
4412
diff
changeset
|
123 rm -rf $NGX_AUTOTEST* |