freddie icon indicating copy to clipboard operation
freddie copied to clipboard

Adding HubInterface to Command causes EventLoop to start during register_shutdown_function

Open fliespl opened this issue 1 year ago • 1 comments

Adding:

    private HubInterface $hub;

    public function __construct(HubInterface $hub)
    {
        parent::__construct();
        $this->hub = $hub;
    }

to any command causes symfony to hang prior finishing Command/Request. It happens due to registerShutdownFunction being registered and starting event loop run. Not sure what is the resolution. Symfony 5.4

https://ss.codeone.pl/ss-2024-06-15-18-52-52-1718470372-U51FCdgM.png

Example Command:

class TestMercureCommand extends Command
{
    private HubInterface $hub;

    public function __construct(HubInterface $hub)
    {
        parent::__construct();
        $this->hub = $hub;
    }

    /**
     * {@inheritdoc}
     */
    protected function configure(): void
    {
        $this->setName('test:mercure');
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->write('test');
        // no call to hub
        return Command::SUCCESS;
    }

fliespl avatar Jun 15 '24 16:06 fliespl

Just a note - happens only with Redis as transport.

fliespl avatar Jun 15 '24 17:06 fliespl