I'm getting the error below in my watchdog logs on every cron run (don't know specifically when it started). It seems that image_resize_filter is trying to remove a directory, and when the amazon stream wrapper tries to delete it, something goes wrong.
Haven't had much time to debug, but didn't know if this was something other people may have experienced. (See, specifically, the rmdir() part and DELETE FROM...
Exception: exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1' in /home/admin/domains/flocknote.com/includes/database/database.inc:2136 Stack trace: #0 /home/admin/domains/flocknote.com/includes/database/database.inc(2136): PDOStatement->execute(Array) #1 /home/admin/domains/flocknote.com/includes/database/database.inc(664): DatabaseStatementBase->execute(Array, Array) #2 /home/admin/domains/flocknote.com/includes/database/query.inc(857): DatabaseConnection->query('DELETE FROM {am...', Array, Array) #3 /home/admin/domains/flocknote.com/sites/all/modules/amazons3/AmazonS3StreamWrapper.inc(710): DeleteQuery->execute() #4 [internal function]: AmazonS3StreamWrapper->rmdir('s3://resize/ima...', 8) #5 /home/admin/domains/flocknote.com/sites/all/modules/image_resize_filter/image_resize_filter.module(613): rmdir('s3://resize/ima...') #6 /home/admin/domains/flocknote.com/sites/all/modules/image_resize_filter/image_resize_filter.module(75): image_resize_filter_delete_derivatives('s3://images/for...') #7 [internal function]: image_resize_filter_file_delete(Object(stdClass)) #8 /home/admin/domains/flocknote.com/includes/module.inc(823): call_user_func_array('image_resize_fi...', Array) #9 /home/admin/domains/flocknote.com/includes/file.inc(1253): module_invoke_all('file_delete', Object(stdClass)) #10
...
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 1653316-4-rmdir-fix.patch | 590 bytes | geerlingguy |
Comments
Comment #1
geerlingguy commentedIt looks like the problem is something in the query on line 710 of AmazonS3StreamWrapper.inc:
It seems that S3 is trying to delete something that doesn't exist in the database, perhaps? I can't see the entire database query, though, so I can't quite tell what's going wrong. Still getting this error every time system_cron() runs.
Comment #2
geerlingguy commentedUpdating title to reflect more specifically what's going on; it doesn't seem to be a problem caused by image_resize_filter.
Comment #3
geerlingguy commentedI'm also getting the following error whenever a user tries removing a file in an imagefield and saving a node:
It looks like something's a bit screwy with the {amazons3_file} table, possibly related to an upgrade issue related to #1291628: Reduce calls to S3?
Comment #4
geerlingguy commentedI found that the problem is that, in certain cases, the
$objectsvariable is actually an empty array, and thedb_or()is never set properly, resulting in the PDOException.If you simply add a condition (see attached patch) to make sure the $objects array has something in it, the problem seems to be resolved.
Comment #5
aasarava commentedFunny, I just fixed this and was going to submit a patch. Do we need to check if $objects is an array? Seems like you can get rid of that part and just simplify by using the empty() check, since that looks for empty arrays.
Comment #6
alexgreyhead commentedThe patch in #4 worked for me too - I'm working with unmanaged files on S3 and file_unmanaged_delete_recursive was triggering errors.
Many thanks! =o)
Al
Comment #7
nikkubhai commentedComment #8
justafishThanks, committed!