Skip to content

Commit 43c1e8d

Browse files
committed
Skip flaky test on macOS due to possible kernel race condition
1 parent 93a2954 commit 43c1e8d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/Query/TcpTransportExecutorTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,14 @@ function ($e) use (&$wait) {
247247

248248
public function testQueryStaysPendingWhenClientCanNotSendExcessiveMessageInOneChunkWhenServerClosesSocket()
249249
{
250+
if (PHP_OS === 'Darwin') {
251+
// Skip on macOS because it exhibits what looks like a kernal race condition when sending excessive data to a socket that is about to shut down (EPROTOTYPE)
252+
// Due to this race condition, this is somewhat flaky. Happens around 75% of the time, use `--repeat=100` to reproduce.
253+
// fwrite(): Send of 4260000 bytes failed with errno=41 Protocol wrong type for socket
254+
// @link http://erickt.github.io/blog/2014/11/19/adventures-in-debugging-a-potential-osx-kernel-bug/
255+
$this->markTestSkipped('Skipped on macOS due to possible race condition');
256+
}
257+
250258
$writableCallback = null;
251259
$loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
252260
$loop->expects($this->once())->method('addWriteStream')->with($this->anything(), $this->callback(function ($cb) use (&$writableCallback) {
@@ -262,10 +270,10 @@ public function testQueryStaysPendingWhenClientCanNotSendExcessiveMessageInOneCh
262270
$address = stream_socket_get_name($server, false);
263271
$executor = new TcpTransportExecutor($address, $loop);
264272

265-
$query = new Query('google' . str_repeat('.com', 10000), Message::TYPE_A, Message::CLASS_IN);
273+
$query = new Query('google' . str_repeat('.com', 100), Message::TYPE_A, Message::CLASS_IN);
266274

267275
// send a bunch of queries and keep reference to last promise
268-
for ($i = 0; $i < 100; ++$i) {
276+
for ($i = 0; $i < 2000; ++$i) {
269277
$promise = $executor->query($query);
270278
}
271279

0 commit comments

Comments
 (0)