Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't terminate a Amp\Http\Server\Request without first consuming the body stream #346

Closed
Pato05 opened this issue Mar 21, 2021 · 1 comment
Labels

Comments

@Pato05
Copy link

Pato05 commented Mar 21, 2021

As the title says, if you return an Amp\Http\Server\Response without first consuming the body stream, the server crashes.

Here is the interested stack trace:

Exception: Cannot get return value of a generator that hasn't returned in vendor/amphp/amp/lib/Coroutine.php:123
Stack trace:
#0 vendor/amphp/amp/lib/Coroutine.php(123): Generator->getReturn()
#1 vendor/amphp/amp/lib/Internal/Placeholder.php(149): Amp\Coroutine->Amp\{closure}()
#2 vendor/amphp/amp/lib/Deferred.php(52): Amp\Promise@anonymous->resolve()
#3 vendor/amphp/amp/lib/Internal/Producer.php(62): Amp\Deferred->resolve()
#4 vendor/amphp/amp/lib/Internal/PrivateIterator.php(35): Amp\Iterator@anonymous->advance()
#5 vendor/amphp/byte-stream/lib/IteratorStream.php(42): Amp\Internal\PrivateIterator->advance()
#6 vendor/amphp/byte-stream/lib/Payload.php(47): Amp\ByteStream\IteratorStream->read()
#7 [internal function]: Amp\ByteStream\Payload->consume()
#8 vendor/amphp/amp/lib/Coroutine.php(67): Generator->current()
#9 vendor/amphp/byte-stream/lib/Payload.php(36): Amp\Coroutine->__construct()
#10 vendor/amphp/http-server-form-parser/src/StreamingParser.php(54): Amp\ByteStream\Payload->__destruct()
#11 [internal function]: Amp\Http\Server\FormParser\StreamingParser->Amp\Http\Server\FormParser\{closure}()
#12 vendor/danog/madelineproto/src/danog/MadelineProto/MTProtoTools/GarbageCollector.php(46): gc_collect_cycles()
#13 vendor/amphp/amp/lib/Loop/NativeDriver.php(142): danog\MadelineProto\MTProtoTools\GarbageCollector::danog\MadelineProto\MTProtoTools\{closure}()
#14 vendor/amphp/amp/lib/Loop/Driver.php(138): Amp\Loop\NativeDriver->dispatch()
#15 vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#16 vendor/amphp/amp/lib/Loop.php(95): Amp\Loop\Driver->run()
#17 vendor/danog/madelineproto/src/danog/MadelineProto/Tools.php(315): Amp\Loop::run()
#18 vendor/danog/madelineproto/src/danog/MadelineProto/AbstractAPIFactory.php(136): danog\MadelineProto\Tools::wait()
#19 vendor/danog/madelineproto/src/danog/MadelineProto/InternalDoc.php(5643): danog\MadelineProto\AbstractAPIFactory->__call()
#20 /start.php(190): danog\MadelineProto\InternalDoc->loop()
#21 {main}
@kelunik kelunik added the v2.x label Dec 3, 2021
@trowski
Copy link
Member

trowski commented Jul 11, 2022

I tried to reproduce this but cannot. I notice gc_collect_cycles is in the stack trace, it seems like the generator that is throwing may have been destroyed which is why it is invalid? Not sure what could have been going on here.

I need more information or a script to reproduce this to fix this. As this is a fairly old issue, I'm going to close this. Feel free to reopen it if you have any more information.

@trowski trowski closed this as completed Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants