amphp / byte-stream

A non-blocking stream abstraction for PHP based on Amp.

Home Page:https://amphp.org/byte-stream

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid watcher issue in ResourceInputStream

kelunik opened this issue · comments

The ResourceInputStream implementation is buggy, which results in InvalidWatcherErrors being thrown in amphp/http-client.

AMP_DEBUG_TRACE_WATCHERS=true ./vendor/bin/phpunit test/ClientHttpBinIntegrationTest.php
PHPUnit 8.4.1 by Sebastian Bergmann and contributors.

.................................E                                34 / 34 (100%)

Time: 31.25 seconds, Memory: 65.84 MB

There was 1 error:

1) Amp\Http\Client\ClientHttpBinIntegrationTest::testConcurrentSlowNetworkInterceptor
Amp\Loop\InvalidWatcherError: Cannot reference an invalid watcher identifier: 'o'

Creation Trace:
#0 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop.php:183 Amp\Loop\TracingDriver->onReadable()
#1 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/byte-stream/lib/ResourceInputStream.php:102 Amp\Loop::onReadable()
#2 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/socket/src/ResourceSocket.php:72 Amp\ByteStream\ResourceInputStream->__construct()
#3 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/socket/src/ResourceSocket.php:40 Amp\Socket\ResourceSocket->__construct()
#4 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/socket/src/DnsConnector.php:122 Amp\Socket\ResourceSocket::fromClientSocket()
#5 Amp\Socket\DnsConnector::Amp\Socket\{closure}()
#6 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Coroutine.php:105 Generator->send()
#7 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Internal/Placeholder.php:43 Amp\Coroutine->Amp\{closure}()
#8 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Internal/PrivatePromise.php:23 class@anonymous/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Deferred.php0x7fe1ece202d7->onResolve()
#9 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Internal/Placeholder.php:125 Amp\Internal\PrivatePromise->onResolve()
#10 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Deferred.php:45 class@anonymous/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Deferred.php0x7fe1ece202d7->resolve()
#11 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/functions.php:233 Amp\Deferred->resolve()
#12 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Internal/Placeholder.php:130 Amp\Promise\{closure}()
#13 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Deferred.php:45 class@anonymous/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Deferred.php0x7fe1ece202d7->resolve()
#14 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/NativeDriver.php:229 Amp\Deferred->resolve()
#15 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/NativeDriver.php:97 Amp\Loop\NativeDriver->selectStreams()
#16 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/Driver.php:134 Amp\Loop\NativeDriver->dispatch()
#17 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/Driver.php:72 Amp\Loop\Driver->tick()
#18 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/TracingDriver.php:22 Amp\Loop\Driver->run()
#19 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop.php:84 Amp\Loop\TracingDriver->run()
#20 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/phpunit-util/src/AsyncTestCase.php:64 Amp\Loop::run()
#21 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestCase.php:1400 Amp\PHPUnit\AsyncTestCase->runAsyncTest()
#22 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/phpunit-util/src/AsyncTestCase.php:36 PHPUnit\Framework\TestCase->runTest()
#23 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestCase.php:1020 Amp\PHPUnit\AsyncTestCase->runTest()
#24 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestResult.php:691 PHPUnit\Framework\TestCase->runBare()
#25 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestCase.php:752 PHPUnit\Framework\TestResult->run()
#26 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestSuite.php:569 PHPUnit\Framework\TestCase->run()
#27 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:616 PHPUnit\Framework\TestSuite->run()
#28 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/TextUI/Command.php:200 PHPUnit\TextUI\TestRunner->doRun()
#29 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/TextUI/Command.php:159 PHPUnit\TextUI\Command->run()
#30 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/phpunit:61 PHPUnit\TextUI\Command::main()

Cancel Trace:
#0 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop.php:294 Amp\Loop\TracingDriver->cancel()
#1 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/byte-stream/lib/ResourceInputStream.php:141 Amp\Loop::cancel()
#2 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/socket/src/ResourceSocket.php:140 Amp\ByteStream\ResourceInputStream->read()
#3 /home/kelunik/GitHub/amphp/http-client/src/Connection/Http2Connection.php:469 Amp\Socket\ResourceSocket->read()
#4 Amp\Http\Client\Connection\Http2Connection->run()
#5 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Coroutine.php:105 Generator->send()
#6 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Internal/Placeholder.php:130 Amp\Coroutine->Amp\{closure}()
#7 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Deferred.php:45 class@anonymous/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Deferred.php0x7fe1ece202d7->resolve()
#8 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/byte-stream/lib/ResourceInputStream.php:101 Amp\Deferred->resolve()
#9 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/NativeDriver.php:198 Amp\ByteStream\ResourceInputStream::Amp\ByteStream\{closure}()
#10 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/NativeDriver.php:97 Amp\Loop\NativeDriver->selectStreams()
#11 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/Driver.php:134 Amp\Loop\NativeDriver->dispatch()
#12 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/Driver.php:72 Amp\Loop\Driver->tick()
#13 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/TracingDriver.php:22 Amp\Loop\Driver->run()
#14 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop.php:84 Amp\Loop\TracingDriver->run()
#15 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/phpunit-util/src/AsyncTestCase.php:64 Amp\Loop::run()
#16 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestCase.php:1400 Amp\PHPUnit\AsyncTestCase->runAsyncTest()
#17 /home/kelunik/GitHub/amphp/http-client/vendor/amphp/phpunit-util/src/AsyncTestCase.php:36 PHPUnit\Framework\TestCase->runTest()
#18 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestCase.php:1020 Amp\PHPUnit\AsyncTestCase->runTest()
#19 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestResult.php:691 PHPUnit\Framework\TestCase->runBare()
#20 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestCase.php:752 PHPUnit\Framework\TestResult->run()
#21 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/Framework/TestSuite.php:569 PHPUnit\Framework\TestCase->run()
#22 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:616 PHPUnit\Framework\TestSuite->run()
#23 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/TextUI/Command.php:200 PHPUnit\TextUI\TestRunner->doRun()
#24 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/src/TextUI/Command.php:159 PHPUnit\TextUI\Command->run()
#25 /home/kelunik/GitHub/amphp/http-client/vendor/phpunit/phpunit/phpunit:61 PHPUnit\TextUI\Command::main()

/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/TracingDriver.php:132
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop.php:311
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/byte-stream/lib/ResourceInputStream.php:225
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/socket/src/ResourceSocket.php:170
/home/kelunik/GitHub/amphp/http-client/src/Connection/Http2Connection.php:333
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Coroutine.php:60
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/functions.php:66
/home/kelunik/GitHub/amphp/http-client/src/Connection/Http2Connection.php:435
/home/kelunik/GitHub/amphp/http-client/src/Connection/HttpStream.php:49
/home/kelunik/GitHub/amphp/http-client/src/Internal/InterceptedStream.php:44
/home/kelunik/GitHub/amphp/http-client/src/Interceptor/ModifyRequest.php:31
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Coroutine.php:105
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Internal/Placeholder.php:130
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Coroutine.php:110
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Internal/Placeholder.php:130
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Delayed.php:22
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/TracingDriver.php:47
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/NativeDriver.php:121
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/Driver.php:134
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/Driver.php:72
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop/TracingDriver.php:22
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/amp/lib/Loop.php:84
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/phpunit-util/src/AsyncTestCase.php:64
/home/kelunik/GitHub/amphp/http-client/vendor/amphp/phpunit-util/src/AsyncTestCase.php:36

ERRORS!
Tests: 34, Assertions: 72, Errors: 1.