chiark / gitweb /
+ * Fixed infrequent race causing assertion failure in adns__tcp_broken
authorian <ian>
Sun, 7 May 2000 17:26:06 +0000 (17:26 +0000)
committerian <ian>
Sun, 7 May 2000 17:26:06 +0000 (17:26 +0000)
@@ -1,18 +1,20 @@
-uadns (0.8) BETA; urgency=low
+uadns (0.8) BETA; urgency=medium

   * bug_if_query_done feature for debugging (SHOULD BE TAKEN OUT FOR RELEASE)

   Bugfixes:
   * Race near adns_beforeselect which could cause infinite timeout fixed
     (it's now less agressive, and will more often return a zero timeout.)
+  * Fixed infrequent race causing assertion failure in adns__tcp_broken
+    `ads->tcpstate == server_connecting || ads->tcpstate == server_ok'.
   * Spurious `server failure on unidentifiable query' warning suppressed.
+  * If we get a referral, don't also always complain falsely about RD==0.
   * adnslogres: cast chars to unsigned char before using ctype.h macros.
   * In _beforeselect, global failure now means zero timeout, and in
     tcp_events, really never try to do anything with the TCP connection if
     act is zero.  This might possibly cause an infinite delay (ie, lockup)
     if things go badly wrong *and* a really unlikely race happens.
   * Test suite `lines of syscall left' value is correct; !0 is failure.
-  * If we get a referral, don't also always complain falsely about RD==0.

   Portability fixes:
   * install-sh (from autoconf 2.12 Debian r13) included.

changelog
regress/case-tcpbreakin.err [new file with mode: 0644]
regress/case-tcpbreakin.out [new file with mode: 0644]
regress/case-tcpbreakin.sys [new file with mode: 0644]
regress/case-tcpptr.err [new file with mode: 0644]
regress/case-tcpptr.out [new file with mode: 0644]
regress/case-tcpptr.sys [new file with mode: 0644]
src/event.c

index bf73cfc1d220d30ff36c96d826d60f7f6c41c581..ecc6ae28ee28b23d15a829efbc8d8db8e9c269b7 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,18 +1,20 @@
-uadns (0.8) BETA; urgency=low
+uadns (0.8) BETA; urgency=medium
 
   * bug_if_query_done feature for debugging (SHOULD BE TAKEN OUT FOR RELEASE) 
 
   Bugfixes:
   * Race near adns_beforeselect which could cause infinite timeout fixed
     (it's now less agressive, and will more often return a zero timeout.)
+  * Fixed infrequent race causing assertion failure in adns__tcp_broken
+    `ads->tcpstate == server_connecting || ads->tcpstate == server_ok'.
   * Spurious `server failure on unidentifiable query' warning suppressed.
+  * If we get a referral, don't also always complain falsely about RD==0.
   * adnslogres: cast chars to unsigned char before using ctype.h macros.
   * In _beforeselect, global failure now means zero timeout, and in
     tcp_events, really never try to do anything with the TCP connection if
     act is zero.  This might possibly cause an infinite delay (ie, lockup)
     if things go badly wrong *and* a really unlikely race happens.
   * Test suite `lines of syscall left' value is correct; !0 is failure.
-  * If we get a referral, don't also always complain falsely about RD==0.
 
   Portability fixes:
   * install-sh (from autoconf 2.12 Debian r13) included.
diff --git a/regress/case-tcpbreakin.err b/regress/case-tcpbreakin.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/regress/case-tcpbreakin.out b/regress/case-tcpbreakin.out
new file mode 100644 (file)
index 0000000..46cafba
--- /dev/null
@@ -0,0 +1,8 @@
+adns debug: using nameserver 172.18.45.6
+6.45.18.172.in-addr.arpa flags 2 type 65548 PTR(checked) submitted
+adns debug: TCP connected (NS=172.18.45.6)
+adns warning: TCP connection failed: write: Broken pipe (NS=172.18.45.6)
+adns debug: TCP connected (NS=172.18.45.6)
+6.45.18.172.in-addr.arpa flags 2 type PTR(checked): OK; nrrs=1; cname=$; owner=$; ttl=86400
+ davenant.relativity.greenend.org.uk
+rc=0
diff --git a/regress/case-tcpbreakin.sys b/regress/case-tcpbreakin.sys
new file mode 100644 (file)
index 0000000..4979230
--- /dev/null
@@ -0,0 +1,114 @@
+default
+:65548 2/6.45.18.172.in-addr.arpa
+ start 957718868.938329
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000161
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000059
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000038
+ socket type=SOCK_STREAM
+ socket=5
+ +0.001056
+ fcntl fd=5 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000238
+ fcntl fd=5 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000055
+ connect fd=5 addr=172.18.45.6:53
+ connect=EINPROGRESS
+ +0.000723
+ select max=6 rfds=[4] wfds=[5] efds=[] to=13.997928
+ select=1 rfds=[] wfds=[5] efds=[]
+ +0.000536
+ read fd=5 buflen=1
+ read=EAGAIN
+ +0.000118
+ write fd=5
+     002a311f 01000001 00000000 00000136 02343502 31380331 37320769 6e2d6164
+     64720461 72706100 000c0001.
+ write=44
+ +0.001433
+ select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.995841
+ select=1 rfds=[5] wfds=[] efds=[]
+ +0.000260
+ read fd=5 buflen=2
+ read=OK
+     00d7.
+ +0.000302
+ read fd=5 buflen=215
+ read=OK
+     311f8580 00010001 00030003 01360234 35023138 03313732 07696e2d 61646472
+     04617270 6100000c 0001c00c 000c0001 00015180 00250864 6176656e 616e740a
+     72656c61 74697669 74790867 7265656e 656e6403 6f726702 756b0002 34350231
+     38033137 3207696e 2d616464 72046172 70610000 02000100 01518000 06036e73
+     30c03fc0 5b000200 01000151 80000603 6e7331c0 3fc05b00 02000100 01518000
+     06036e73 32c03fc0 7d000100 01000151 800004ac 122d06c0 8f000100 01000151
+     800004ac 122d41c0 a1000100 01000151 800004ac 122d01.
+ +0.001364
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 08646176 656e616e 740a7265 6c617469 76697479
+     08677265 656e656e 64036f72 6702756b 00000100 01.
+ sendto=EMSGSIZE
+ +0.000001
+ write fd=5
+     00353120 01000001 00000000 00000864 6176656e 616e740a 72656c61 74697669
+     74790867 7265656e 656e6403 6f726702 756b0000 010001.
+ write=EPIPE
+ +0.001233
+ close fd=5
+ close=OK
+ +0.000001
+ select max=5 rfds=[4] wfds=[] efds=[] to=0.000000
+ select=1 rfds=[] wfds=[] efds=[]
+ +0.000118
+ socket type=SOCK_STREAM
+ socket=5
+ +0.001056
+ fcntl fd=5 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000238
+ fcntl fd=5 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000055
+ connect fd=5 addr=172.18.45.6:53
+ connect=EINPROGRESS
+ +0.000723
+ select max=6 rfds=[4] wfds=[5] efds=[] to=13.997928
+ select=1 rfds=[] wfds=[5] efds=[]
+ +0.000536
+ read fd=5 buflen=1
+ read=EAGAIN
+ +0.000723
+ write fd=5
+     00353120 01000001 00000000 00000864 6176656e 616e740a 72656c61 74697669
+     74790867 7265656e 656e6403 6f726702 756b0000 010001.
+ write=44
+ +0.000001
+ select max=6 rfds=[4,5] wfds=[5] efds=[5] to=29.993649
+ select=1 rfds=[5] wfds=[] efds=[]
+ +0.000260
+ read fd=5 buflen=217
+ read=OK
+     00c5
+     31208580 00010001 00030003 08646176 656e616e 740a7265 6c617469 76697479
+     08677265 656e656e 64036f72 6702756b 00000100 01c00c00 01000100 01518000
+     04ac122d 060a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b
+     00000200 01000151 80000603 6e7330c0 45c04500 02000100 01518000 06036e73
+     31c045c0 45000200 01000151 80000603 6e7332c0 45c06b00 01000100 01518000
+     04ac122d 06c07d00 01000100 01518000 04ac122d 41c08f00 01000100 01518000
+     04ac122d 01.
+ +0.001171
+ read fd=5 buflen=217
+ read=EAGAIN
+ +0.000189
+ close fd=4
+ close=OK
+ +0.000352
+ close fd=5
+ close=OK
+ +0.000507
diff --git a/regress/case-tcpptr.err b/regress/case-tcpptr.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/regress/case-tcpptr.out b/regress/case-tcpptr.out
new file mode 100644 (file)
index 0000000..a22ae89
--- /dev/null
@@ -0,0 +1,6 @@
+adns debug: using nameserver 172.18.45.6
+6.45.18.172.in-addr.arpa flags 2 type 65548 PTR(checked) submitted
+adns debug: TCP connected (NS=172.18.45.6)
+6.45.18.172.in-addr.arpa flags 2 type PTR(checked): OK; nrrs=1; cname=$; owner=$; ttl=86400
+ davenant.relativity.greenend.org.uk
+rc=0
diff --git a/regress/case-tcpptr.sys b/regress/case-tcpptr.sys
new file mode 100644 (file)
index 0000000..bdddeea
--- /dev/null
@@ -0,0 +1,88 @@
+default
+:65548 2/6.45.18.172.in-addr.arpa
+ start 957718868.938329
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000161
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000059
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000038
+ socket type=SOCK_STREAM
+ socket=5
+ +0.001056
+ fcntl fd=5 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000238
+ fcntl fd=5 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000055
+ connect fd=5 addr=172.18.45.6:53
+ connect=EINPROGRESS
+ +0.000723
+ select max=6 rfds=[4] wfds=[5] efds=[] to=13.997928
+ select=1 rfds=[] wfds=[5] efds=[]
+ +0.000536
+ read fd=5 buflen=1
+ read=EAGAIN
+ +0.000118
+ write fd=5
+     002a311f 01000001 00000000 00000136 02343502 31380331 37320769 6e2d6164
+     64720461 72706100 000c0001.
+ write=44
+ +0.001433
+ select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.995841
+ select=1 rfds=[5] wfds=[] efds=[]
+ +0.000260
+ read fd=5 buflen=2
+ read=OK
+     00d7.
+ +0.000302
+ read fd=5 buflen=215
+ read=OK
+     311f8580 00010001 00030003 01360234 35023138 03313732 07696e2d 61646472
+     04617270 6100000c 0001c00c 000c0001 00015180 00250864 6176656e 616e740a
+     72656c61 74697669 74790867 7265656e 656e6403 6f726702 756b0002 34350231
+     38033137 3207696e 2d616464 72046172 70610000 02000100 01518000 06036e73
+     30c03fc0 5b000200 01000151 80000603 6e7331c0 3fc05b00 02000100 01518000
+     06036e73 32c03fc0 7d000100 01000151 800004ac 122d06c0 8f000100 01000151
+     800004ac 122d41c0 a1000100 01000151 800004ac 122d01.
+ +0.001364
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 08646176 656e616e 740a7265 6c617469 76697479
+     08677265 656e656e 64036f72 6702756b 00000100 01.
+ sendto=EMSGSIZE
+ +0.000001
+ write fd=5
+     00353120 01000001 00000000 00000864 6176656e 616e740a 72656c61 74697669
+     74790867 7265656e 656e6403 6f726702 756b0000 010001.
+ write=53
+ +0.001233
+ read fd=5 buflen=217
+ read=EAGAIN
+ +0.000100
+ select max=6 rfds=[4,5] wfds=[5] efds=[5] to=29.997000
+ select=1 rfds=[5] wfds=[] efds=[]
+ +0.000118
+ read fd=5 buflen=217
+ read=OK
+     00c5
+     31208580 00010001 00030003 08646176 656e616e 740a7265 6c617469 76697479
+     08677265 656e656e 64036f72 6702756b 00000100 01c00c00 01000100 01518000
+     04ac122d 060a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b
+     00000200 01000151 80000603 6e7330c0 45c04500 02000100 01518000 06036e73
+     31c045c0 45000200 01000151 80000603 6e7332c0 45c06b00 01000100 01518000
+     04ac122d 06c07d00 01000100 01518000 04ac122d 41c08f00 01000100 01518000
+     04ac122d 01.
+ +0.001171
+ read fd=5 buflen=217
+ read=EAGAIN
+ +0.000189
+ close fd=4
+ close=OK
+ +0.000352
+ close fd=5
+ close=OK
+ +0.000507
index 9e7bdc298756d125d2aec723a40da1b804ec9e11..bd5325520694b413edc9e838f981a899f2cebb7d 100644 (file)
@@ -333,7 +333,7 @@ int adns_processreadable(adns_state ads, int fd, const struct timeval *now) {
   case server_ok:
     if (fd != ads->tcpsocket) break;
     assert(!ads->tcprecv_skip);
-    for (;;) {
+    do {
       if (ads->tcprecv.used >= ads->tcprecv_skip+2) {
        dgramlen= ((ads->tcprecv.buf[ads->tcprecv_skip]<<8) |
                   ads->tcprecv.buf[ads->tcprecv_skip+1]);
@@ -367,9 +367,9 @@ int adns_processreadable(adns_state ads, int fd, const struct timeval *now) {
          if (errno_resources(errno)) { r= errno; goto xit; }
        }
        adns__tcp_broken(ads,"read",r?strerror(errno):"closed");
-       r= 0; goto xit;
       }
-    } /* never reached */
+    } while (ads->tcpstate == server_ok);
+    r= 0; goto xit;
   default:
     abort();
   }