-
Notifications
You must be signed in to change notification settings - Fork 32
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
Output after the loop is closed #32
Comments
Can you provide a failing test case and maybe also a patch?
On Nov 15, 2018 21:55, "Johnny van de Laar" <notifications@github.com> wrote:
Below is my code that creates several persistent subscriptions. When I have
verbose logging enabled and use the console logger on my event store client
connection then this gives me this error:
Fatal error: Uncaught Amp\ByteStream\ClosedException: The stream is
not writable in
/app/vendor/amphp/byte-stream/lib/ResourceOutputStream.php:164
Stack trace:
#0 /app/vendor/amphp/byte-stream/lib/ResourceOutputStream.php(144):
Amp\ByteStream\ResourceOutputStream->send('[2018-11-15 13:...', false)
#1 /app/vendor/amphp/log/src/StreamHandler.php(56):
Amp\ByteStream\ResourceOutputStream->write('[2018-11-15 13:...')
#2 /app/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(39):
Amp\Log\StreamHandler->write(Array)
#3 /app/vendor/monolog/monolog/src/Monolog/Logger.php(344):
Monolog\Handler\AbstractProcessingHandler->handle(Array)
#4 /app/vendor/monolog/monolog/src/Monolog/Logger.php(623):
Monolog\Logger->addRecord(100, 'EventStoreNodeC...', Array)
#5 /app/vendor/prooph/event-store-client/src/Internal/EventStoreConnectionLogicHandler.php(926):
Monolog\Logger->debug('EventStoreNodeC...')
#6 /app/vendor/prooph/event-store-client/src/Internal/EventStoreConnectionLogicHandler.php(184):
Prooph\EventStoreClient\ in
/app/vendor/amphp/byte-stream/lib/ResourceOutputStream.php on line 164
Which is caused by the __destruct function on the
EventStoreAsyncNodeConnection class which closes the connection and then
wants to output some debug output. Manually closing the connection inside
the loop doesn't help because the __destruct doesn't check if it's already
closed.
public function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('Create subscriptions');
Loop::run(function () use ($output): Generator {
yield $this->connection->connectAsync();
foreach ($this->subscriptions as $subscription) {
$name = (string) $subscription;
try {
$result = yield
$this->connection->createPersistentSubscriptionAsync(
$subscription->getStream(),
$subscription->getGroupName(),
$subscription->getSettings()
);
$output->writeln(
sprintf('=> <comment>%s</comment>:
<comment>%s</comment>', $name, $result->status()->name())
);
} catch (Throwable $error) {
$output->writeln(
sprintf('=> <comment>%s</comment>:
<error>%s</error>', $name, $error->getMessage())
);
}
}
Loop::stop();
});
$output->writeln('Subscriptions created');
return 0;
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#32>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAYEvFMjmpZRYdEx1ZyyYZbr2u8Ns1eFks5uvXJSgaJpZM4Yf2AH>
.
|
Hmm building a small reproducable script proves to be quite hard because everything is caused by the order in which objects are destructed. So if the I solved it for myself by not using the Best solution would be that the |
The closing of the event-store-connection will not close the output (which is \STDOUT). The exception says that \STDOUT is not writeable. I'm not sure yet under which conditions \STDOUT can be not writeable. By the way: I created a ticket here for now: amphp/log#1 Let's see what the amp-guys can say. |
Thank you very much! |
@jvdlaar Amp team confirms this is a problem on their side, so I'm closing this here. You can track the related issue and check once it is resolved or further discuss there. I cannot do something about it at this point. |
Below is my code that creates several persistent subscriptions. When I have verbose logging enabled and use the console logger on my event store client connection then this gives me this error:
Which is caused by the
__destruct
function on theEventStoreAsyncNodeConnection
class which closes the connection and then wants to output some debug output. Manually closing the connection inside the loop doesn't help because the__destruct
doesn't check if it's already closed.The text was updated successfully, but these errors were encountered: