Remove connection close from QueueBase::shutdown()

Created on 18 August 2025, about 2 months ago

Problem/Motivation

A queue shutting down should not cause the connection to be closed for all other queues.

Steps to reproduce

> \Drupal::service('queue')->get('test3')->createItem('test');
= "21e91e4a-e684-47d3-81b6-97a21d8ada22"

> \Drupal::service('queue')->get('test')->shutdown();
= null

> \Drupal::service('queue')->get('test3')->createItem('test');
 [error]  Failed to send item to queue test3: Channel connection is closed. 
= false

Proposed resolution

Remove connection->close() from shutdown()

Remaining tasks

User interface changes

API changes

QueueBase::shutdown() will not close connection.

Data model changes

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States cmlara

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @cmlara
  • Pipeline finished with Success
    about 2 months ago
    Total: 150s
    #575253
  • 🇮🇳India arunsahijpal

    Hi @cmlara,
    Done the required changes, pls check.

  • 🇺🇸United States cmlara

    NW for the PHPstan Baseline ignore removal and an IS update to capture the changes to scope.

  • Pipeline finished with Success
    about 2 months ago
    #576429
  • 🇮🇳India arunsahijpal

    updated the baseline and IS.

  • 🇺🇸United States cmlara

    updated the baseline and IS.

    I was more looking for the IS to reflect the change that now the queue channel would be permitted to be re-oppened without having to construct a new queue instance as this significantly changed the scope of the issue from not closing the connection (yet closing the channel), to changing the handling of channel shutdowns and recovery.

    On a positive note it allowed queue channels to rebuild themselves if they need to, however on a negative it means there is no way to assure the queue instance is not used to inject more messages. Could this be a concern? Why would we call Shutdown if we just wanted to allow a re-connect?

    I'll note the sample uses the Drupal Queue service, though really that is somewhat a bad example (we likely need a separate issue to de-scope this from public) as it only constructs a single instance and has no logic to create a new one, 3rd party API may not have this requirement (symfony non-shared service) so the ability to call createItem() again on the same queue can be considered a non-issue.

Production build 0.71.5 2024