-
Notifications
You must be signed in to change notification settings - Fork 22
Potential Data Truncation in Task Logs Leading to Errors with php spark tasks:list #187
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
We have two options to consider: 1. Continue storing logs via the settings libraryThis approach requires truncating logs based on the available space in the However, this method has limitations:
2. Create a dedicated table for task logsThis option allows for a more appropriate and scalable log storage approach:
What do you think @lonnieezell @paulbalandan @samsonasik ? |
Sorry, I'm not familiar with why is the full error object needed to be serialized. Can we not just get the exception class, message, file and line? |
Actually, I forgot about this one, but yes - we can store just the basic info. I don't see a lot of benefits in storing everything. |
This is exactly what we do in the queue library: https://github.com/codeigniter4/queue/blob/develop/src/Handlers/BaseHandler.php#L171 |
I made a PR: #188 |
Description:
In the current implementation, the exception written to
$taskLog->error
is serialized in its entirety usingserialize($taskLog->error ?? null)
and stored in the database. The field used to store this data is of type TEXT. The serialized exception object can become quite large, especially when the exception includes a long stack trace or nested exceptions. This can lead to data truncation when writing to the TEXT field, as its size is limited. This data truncation causes errors when callingphp spark tasks:list
Solution:
Instead of storing the entire serialized exception, you can store only the critical exception data. This will reduce the size of the data that needs to be stored and will ensure that the exception information is stored more reliably. However, this will not completely solve the problem.
Example Implementation:
The text was updated successfully, but these errors were encountered: