-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
LockableTrait Documentation Lacks Clarity on Multi-Server Limitations #20210
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
You:
The documentation:
symfony/symfony#35535 (comment):
There is nothing to add IMO. |
Thanks @n0rbyt3 for highlighting that bit. It was not clear to me that sentence refers to LockableTrait. From the way this page is written this is not obvious (at least to me). The page starts with a general discussion about locks, linking to wikipedia. This reads as if it is related to locks in general. Stating that locks (in general) can only be used to lock commands running "on the same server" is not true. With the Lock component we indeed can lock commands in distributed systems as well. What is truly limited to single-server applications is the LockableTrait. This is done intentionally by design, which is understandable. But I suggest that we highlight this limitation in the very same paragraph where we introduce the the LockableTrait. To me the page as a whole should be build up like this:
What do you think about it? |
Thank you for this issue. |
This should be discussed in the issue tracker of the documentation, to be seen by the documentation team And even better, you could do a PR to improve the documentation. |
I will be happy to open a PR if you agree that the docs need improvement on this particular section. @n0rbyt3 did not seem convinced. It seems like I am the only one finding that part confusing. If this is so we can leave the docs as the are. |
from sf 7.1, you can directly customize the lockFactory on the trait, you should close it. |
Description
The documentation for LockableTrait does not clearly mention its limitations regarding available locking backends and its unsuitability for multi-server environments. This can lead to developers (like me) unknowingly using it in scenarios where it won't work as expected, potentially causing issues with concurrent execution.
The documentation should explicitly state that LockableTrait is primarily designed for single-server (or shared filesystem) scenarios.
See also symfony/symfony#35535
What do you think?
Example
However, it's important to note that LockableTrait has certain limitations:
• Limited to single-server environments: LockableTrait relies on internal lock storage that is not shared across servers. This means it is not suitable for distributed locking needed in multi-server setups.
• Limited customization: While LockableTrait simplifies locking for basic scenarios, it restricts customization options. It uses internally created stores and factories, preventing the use of custom lock factories or integration with external lock stores like Redis.
For multi-server environments or scenarios requiring more control and customization, we recommend using the LockFactory component directly. Refer to the Lock component documentation for the guidance.
The text was updated successfully, but these errors were encountered: