-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] DeduplicateStamp
cannot be serialized (if certain lock stores are used)
#60667
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
Comments
It's kinda tricky because when the stamp is generated we only provide a key and cannot know which store will use this key. Key is flagged as non serializable for some store when calling
If we remove the Key and don't serialize it, the lock will never be released. Do you have some idea/solution in mind ? @kbond |
Does the key object need to be serialized? Can we just serialize the resource string? I'm not super familiar with the lock component. |
Serializing it is required, as this is what allows the messenger consumer to become the owner of the lock acquired in the process dispatching the stamped message. The Using another key for the same resource string has a totally different meaning. It would try to acquire a conflicting lock (which would fail to be acquired as the other one is not released) |
See https://symfony.com/doc/current/components/lock.html#serializing-locks for the documentation about serializing locks. |
It might be great to expose a method on lockFactory/store to know earlier that it's incompatible with serializer. |
Seeing as it is (will be) documented as "only supporting serializable locks", I don't think there's anything to do here. It isn't a big anyway. |
Symfony version(s) affected
7.3
Description
Exception is thrown when serializing (using the PHP serializer)
DeduplicateStamp
because some lock stores (ie flock) prevent theKey
from being serialized.Ref: zenstruck/messenger-test#95
(#60659 also has issues with DeduplicateStamp but with the
symfony/serializer
)How to reproduce
When using the PHP messenger serializer, a flock lock store, send an async message with a
DeduplicateStamp
.Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: