Fatal error from thumbnail generate
Permalink
I had a site (C5 8.4.3) go down with the error:
Call to a member function getTypeObject() on null
with this in the error log:
concrete/src/Http/Middleware/ThumbnailMiddleware.php on line 152
That particular block looks like
I changed ln 152 to
This got the site back up but makes me think that I have some orphaned records somewhere. The automated job 'Fill thumbnail database table' was run the previous night without any errors. It previously had halted with the error 'mysql Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction'.
In the dashboard log I'm seeing a ton of errors, from before the successful job re-run, that look like 'Failed to generate or locate the thumbnail for file "7365"'. When I look up the filename in the FileVersions table and then search for it in the file manager there are multiple copies with the same filename with the matching ID from the error will have the 'failed to load' icon displayed. So I gather something screwy is happening when images are added or thumbnails made.
If anyone has any insight on this I'd be interested to know.
Call to a member function getTypeObject() on null
with this in the error log:
concrete/src/Http/Middleware/ThumbnailMiddleware.php on line 152
That particular block looks like
} elseif ($type = Version::getByHandle($thumbnail['thumbnailTypeHandle'])) { // This is a predefined thumbnail type, lets just call the version->rescan $fv = $file->getVersion($thumbnail['fileVersionID']); if ($fv->getTypeObject()->supportsThumbnails()) { $fv->generateThumbnail($type); $fv->releaseImagineImage(); }
I changed ln 152 to
if (is_object($fv) && $fv->getTypeObject()->supportsThumbnails()) {
This got the site back up but makes me think that I have some orphaned records somewhere. The automated job 'Fill thumbnail database table' was run the previous night without any errors. It previously had halted with the error 'mysql Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction'.
In the dashboard log I'm seeing a ton of errors, from before the successful job re-run, that look like 'Failed to generate or locate the thumbnail for file "7365"'. When I look up the filename in the FileVersions table and then search for it in the file manager there are multiple copies with the same filename with the matching ID from the error will have the 'failed to load' icon displayed. So I gather something screwy is happening when images are added or thumbnails made.
If anyone has any insight on this I'd be interested to know.
The issue was records in Files and FileVersions tables that didn't actually exist in the filesystem. I took a crack at trying to figure out why that was happening but I wasn't able to reproduce the error.
I ended up writing a script to query for all records in FileVersions where fvIsApproved=1 and then check that the file exists in the file system. This produced a list of about thirty files all uploaded within a day of each other back in 2015 where the file path given in FileManager didn't actually exist.
The site was probably at a different version back then (5.7.?), with an older php and module list. Whatever problem that caused the condition likely doesn't exist anymore. The server had just been rebooted so I wonder if that somehow triggered the attempt to generate thumbnails for the bad paths.
I ended up writing a script to query for all records in FileVersions where fvIsApproved=1 and then check that the file exists in the file system. This produced a list of about thirty files all uploaded within a day of each other back in 2015 where the file path given in FileManager didn't actually exist.
The site was probably at a different version back then (5.7.?), with an older php and module list. Whatever problem that caused the condition likely doesn't exist anymore. The server had just been rebooted so I wonder if that somehow triggered the attempt to generate thumbnails for the bad paths.
I just experienced a similar issue. While I am not sure what the root cause of the issue was, I can tell you that it was solved by deleting the most recent file version that was uploaded and then clearing the cache. I was unable to log into the site at all so I had to remove the File Version from the database manually and then clear the cache from the command line:
https://documentation.concrete5.org/developers/appendix/cli-commands...
Hope this helps