Skip to content

Commit

Permalink
watcher.t: reduce flakiness
Browse files Browse the repository at this point in the history
logger seems to be getting POLLHUP spuriously on slower platforms.

I haven't tracked it down but it's either running poll() tons of times
trying to write to the socket or the way perl is handling replacing a
file descriptor (overwriting $watcher which closes old and creates new
socket).

instead wait for the writes to flush which probably fixes other issues
regardless, and don't overwrite the socket object.
  • Loading branch information
dormando committed Oct 29, 2020
1 parent c9f10b3 commit 31956fd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions t/watcher.t
Expand Up @@ -82,10 +82,14 @@ if ($res eq "STORED\r\n") {
for (1 .. $keycount) {
print $client "set n,foo$_ 0 0 11000 noreply\r\n$value\r\n";
}
# wait for all of the writes to go through.
print $client "version\r\n";
$res = <$client>;
sleep 4;

$watcher = $server->new_sock;
print $watcher "watch mutations evictions\n";
$res = <$watcher>;
my $mwatcher = $server->new_sock;
print $mwatcher "watch mutations evictions\n";
$res = <$mwatcher>;
is($res, "OK\r\n", "new watcher enabled");
my $watcher2 = $server->new_sock;
print $watcher2 "watch evictions\n";
Expand All @@ -95,7 +99,7 @@ if ($res eq "STORED\r\n") {
print $client "set bfoo 0 0 11000 noreply\r\n$value\r\n";
my $found_log = 0;
my $found_ev = 0;
while (my $log = <$watcher>) {
while (my $log = <$mwatcher>) {
$found_log = 1 if ($log =~ m/type=item_store/);
$found_ev = 1 if ($log =~ m/type=eviction/);
last if ($found_log && $found_ev);
Expand Down

0 comments on commit 31956fd

Please sign in to comment.