Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We avoid serializing the database connection, if it is serialized we throw an exception.
If you're building a form that needs a database queue instance, you cannot inject it as it will result in 'The database connection is not serializable' as the queue doesn't manage the connection reference on sleep/wakeup.
Proposed resolution
Make Queue use DependencySerializationTrait
Remaining tasks
Review
User interface changes
None
API changes
None
Beta phase evaluation
Issue category | Bug because injection throws Exception |
---|---|
Issue priority | Normal |
Disruption | None |
Comment | File | Size | Author |
---|---|---|---|
#19 | queue-serialize-boom-2481729.pass_.patch | 3.45 KB | larowlan |
#12 | queue-serialize-boom-2481729.pass_.patch | 3.45 KB | larowlan |
#12 | queue-serialize-boom-2481729.fail_.patch | 3.45 KB | larowlan |
#12 | interdiff.txt | 523 bytes | larowlan |
#5 | queue-serialize-boom-2481729.pass_.patch | 3.45 KB | larowlan |
Comments
Comment #1
larowlanComment #3
larowlanmeh
Comment #4
larowlanComment #5
larowlanfailing test
Comment #6
larowlanComment #8
andypostnice
Comment #9
alexpottWhy does this class need this trait?
Comment #10
larowlanBecause it's a form as well as a test, but it doesn't extend from FormBase
Comment #11
larowlanTo extrapolate - the intent of the test is to check form serializing, but because the form is also a test, it gets a $this->container property, which can't be serialized, so we add that trait to get past that.
Comment #12
larowlandemonstrating reason for the trait
interdiff is between these two patches
Comment #19
larowlanno idea
Comment #20
larowlanSame file passes, back to rtbc
Comment #21
alexpottCommitted 843670c and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.