about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-12-06 02:40:06 +0000
committerEric Wong <e@80x24.org>2018-12-06 03:42:55 +0000
commit74923a7cb6ace0369455e2155cbf63dfa4be33ea (patch)
treea28d35e1b71a711265a0f2d9d1f1b8bc49e3130b /t
parentfbfd63996ddfc9a23b8a1e0f8756e378f2e196ba (diff)
downloadpublic-inbox-74923a7cb6ace0369455e2155cbf63dfa4be33ea.tar.gz
When a client starts pipelining requests to us which trigger
long responses, we need to keep socket readiness checks disabled
and only enable them when our socket rbuf is drained.

Failure to do this caused aborted clients with
"BUG: nested long response" when Danga::Socket calls event_read
for read-readiness after our "next_tick" sub fires in the
same event loop iteration.

Reported-by: Jonathan Corbet <corbet@lwn.net>

cf. https://public-inbox.org/meta/20181013124658.23b9f9d2@lwn.net/
Diffstat (limited to 't')
-rw-r--r--t/nntpd.t21
1 files changed, 21 insertions, 0 deletions
diff --git a/t/nntpd.t b/t/nntpd.t
index 9c1d0762..ffed4376 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -252,6 +252,27 @@ EOF
                 ok($date <= $t1, 'valid date before stop');
         }
 
+        # pipelined requests:
+        {
+                my $nreq = 90;
+                syswrite($s, "GROUP $group\r\n");
+                my $res = <$s>;
+                my $rdr = fork;
+                if ($rdr == 0) {
+                        use POSIX qw(_exit);
+                        for (1..$nreq) {
+                                <$s> =~ /\A224 / or _exit(1);
+                                <$s> =~ /\A1/ or _exit(2);
+                                <$s> eq ".\r\n" or _exit(3);
+                        }
+                        _exit(0);
+                }
+                for (1..$nreq) {
+                        syswrite($s, "XOVER 1\r\n");
+                }
+                is($rdr, waitpid($rdr, 0), 'reader done');
+                is($? >> 8, 0, 'no errors');
+        }
         {
                 setsockopt($s, IPPROTO_TCP, TCP_NODELAY, 1);
                 syswrite($s, 'HDR List-id 1-');