As far as I know this only occurs in conjunction with cck and pathauto, but since those are two of the most commonly used contrib modules, it's not a minor issue. So here's the problem:
1) pathauto_nodeapi calls module_invoke_all('pathauto_node', 'values', $node) on a node insert/update
2) which calls content_pathauto_node in content_pathauto.inc
3) which calls node_invoke_nodeapi($node, 'view', false, false);
4) which calls image_view
5) which eventually calls image_display
6) which, if the derivative images need regenerating, calls node_save
7) which calls pathauto_nodeapi...
8) loops infinitely
Now, this is a problem only because it's regenerating images, but nevertheless, it's probably not a good idea to save the new images with a node_save, in order to prevent this infinite loop.
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | image_160671_0.patch | 17.67 KB | drewish |
| #22 | image.module_0.txt | 37.8 KB | drewish |
| #21 | image_1.x_160671_1.patch | 14.74 KB | drewish |
| #15 | image_1.x_160671_0.patch | 10.46 KB | drewish |
| #14 | image_1.x_160671.patch | 3 KB | drewish |
Comments
Comment #1
drewish commentedwhere does cck come into that?
Comment #2
mcarbone commentedStep 2: content_pathauto.inc
Comment #3
dsp1 commentedi had a similar issue. Testing on a local machine I installed 1.4. I updated. Then click on home where some images were. The browser seemed to stall. I happened to have the files/images folder open and it was deleting and adding the same image file over and over. canceled browser to stop.
Comment #4
drewish commentedwhich version of pathauto is that?
Comment #5
dsp1 commentedI am using 5.x-1.2
Comment #6
drewish commentedcan you verify the bug with the 5.x-2.x branch?
Comment #7
mcarbone commentedPathauto isn't the problem here -- it just calls module_invoke_all('pathauto_node', 'values', $node) on node insert/updates -- nothing weird there, and it happens in all recent versions (5.x-1.2, 5.x-2.x, HEAD). The problem is with image, which is calling node_save in a place that can potentially also be called by node_save.
What I can't do is verify that drewish's problem is that same as I'm describing here. drewish, can you comment out the node_save in image_display and try it again? If it's still not working, you have a different problem, and should open a new issue.
Comment #8
mcarbone commentedSorry, I means dsp1, not drewish.
Comment #9
drewish commentedi think this is a duplicate of: http://drupal.org/node/129338
Comment #10
mcarbone commentedNo, they are entirely different issues. Token has nothing to do with this infinite loop -- this issue is very specific to the node_save in the image_display function.
Comment #11
drewish commentedthis patch (for HEAD) moves the check for missing images from image_display() to image_load(). and calls image_update() rather than node_save(). i'd love to have some testers running HEAD.
Comment #12
Hetta commentedI'd love to oblige, but where can HEAD be downloaded?
Comment #13
drewish commentedhttp://drupal.org/node/94674 but be aware that it has a different table schema so you'll want to run it on a test server.
Comment #14
drewish commentedhere's a version of the patch for the 5.x-1.x branch.
Comment #15
drewish commentedalright, ignore those last two patches. this one is for the 5.x-1.x branch.
during the node load the module first determines what derivative images should exists and then checks that they do. if there's a problem it regenerates the derivative images and then uses image_update() (rather than node_save() because people didn't like have the last updated date changed) to save the changes.
the good news is that if you're already experiencing screwed up images it should fix them. the bad news is that it rewrites a bunch of stuff so i'm going to need some testers to try this out. please give it a spin and let me know if you run into any errors.
Comment #16
Hetta commentedNo problem with image import into galleries with this patch applied (to the latest 5.x-1 dev).
Comment #17
drewish commentedHeta does that mean it works correctly for you with everything else?
Comment #18
Nick Brown commentedI tried the patch, hoping to resolve the issue I'm seeing;
http://drupal.org/node/171524
Although images are now displayed, they are regenerated every time, which results in message being displayed, and slow down in pages loads.
Comment #19
drewish commentedNickBrown (or anyone else who's running into this problem) it'd be very helpful if you could hop on IRC in #drupal and spend a little time helping me debug this. If you need some info on getting on IRC give this a read: http://drupal.org/node/108355
Comment #20
zoo33 commentedI tested this with the latest 5.x-dev versions of Image and Image assist. It works alright, except I'm seeing the message "Missing derivative images were regenerated for test" on every image view. Happens both within Image assist's Add image window and when viewing image nodes, as well as on story nodes that have inline images in them.
So, Image assist integration is *probably* OK. I'll try to keep up to date with this issue to see if new versions of the patch work.
Comment #21
drewish commentedi was hoping to keep this as simple as possible but since it doesn't seem like that's going to happen i'll aim for correct and well tested.
thanks for the feedback i was able to narrow down the cause of the repeated rebuilding. it turns out that i need to differentiate between saving a new file and rebuilding. i think this patch should do it. i've added some debugging messages so if it tries to rebuild the images it'll explain why.
Comment #22
drewish commentedi never do this but i really want the testing/feedback so i'm going to post a patched version of the module. please give it the full run through:
- upload new images
- edit images
- replace existing images
- rebuild thumbnails
- attach images
- import images
- img_assist them..
in short, do your best to break this.
Comment #23
zoo33 commentedSeems to work. I didn't try everything on your list, but I added images, tried replacing image files, changed size settings etc, while continuously testing them with Image assist.
Only had a slight problem with Image assist when I replaced an image file in an existing image node. The old image paths are still stored in the filter cache of the parent node (such as a story node). That's an img_assist issue though (and it's not a new one). I'm thinking of adding a check for this in img_assist_nodeapi().
Or maybe it's a broader issue... if other modules such as image_attach have similar problems then maybe image.module should empty the filter cache whenever images are replaced? This is unrelated to this issue, but what's your opinion?
Comment #24
Standart commentedDid some testing (upload new images, edit images, replace existing images, rebuild thumbnails) and everything seems to work.
Comment #25
Nick Brown commentedI'm still having the same problem using the module in comment #22. There are more verbose messages about regenerating images, and no images are displayed;
http://www.nickbroon.com/
Observatory Ridge's thumbnail derivative image was missing. The derivatives will be rebuilt to regenerate it.
Observatory Ridge's preview derivative image was missing. The derivatives will be rebuilt to regenerate it.
The derivative images for Observatory Ridge have been regenerated.
Comment #26
drewish commentedNickBrown, looking at your site i think you've got some other issues going on. what image toolkit are you using? can you try out the imagemagick toolkit?
Comment #27
Nick Brown commentedI am using the ImageMagick toolkit;
The path to convert is correct.
The gentoo package I have installed is;
Comment #28
drewish commentedNickBrown, try using GD then. other sites keep getting the regenerating message but the images are created and visible. on your site they're continually generated but not visible. are you sure the files path is correct? does the upload.module let you resize uploaded images correctly?
Comment #29
Nick Brown commentedThe path to cnvert is correct;
Using the built in GD toolkit results in the same symptoms (and the image toolkit reports GD toolkit as properly detected and installed)
As I mentioned here when I used the patch in comment #15 images were displayed, but regenerated every time. With the module from comment #22 no images are displayed and the regenerated message displayed everytime.
Comment #30
dsw9742 commenteddrewish-- looks good to me. no problems so far.
Comment #31
drewish commentedokay, committed to DRUPAL-5, working on a patch for HEAD.
Comment #32
XGI-Wrath commentedHi...
Sorry to break into your thread like this. But I'm seeing similar symptoms:
- After submitting an image, no version of the image is visible.
- Every attempt to view any version (thumb, preview, original) results in an "access denied" error in the log.
- Occasionally I'm seeing the "regeneration" message in the log.
I wanted to try the patch(s) that have been posted but (please excuse the former Nuke admin's ignorance) I don't know how to apply them. Does anybody have a few seconds to explain how to use the patches after they've been posted? I've noticed at least two different formats, so I'm a little nervous about taking shots in the dark.
Thanks in advance.
-=w=-
http://dfbrigade.org
Comment #33
drewish commentedthe attachment on http://drupal.org/node/160671#comment-297969 is a patched copy of the module (which has been committed and will be in the next -dev release). if you're not comfortable applying patches use that.
Comment #34
drewish commentedokay here's the patch for HEAD.
Comment #35
HorsePunchKid commentedHi, drewish. I'm using image-5.x-1.x-dev from 2007-09-03 along with the patch from #15 (#comment-297547) above, and it's misbehaving. I'm not sure if this is a combination you expect people to be testing, though. The symptom is that every image on the page you view gets rebuilt every time.
This had the nasty side effect for me of subscribing every (logged in) visitor to every image they saw and then proceeding to send them a notification about it being updated.
=OI'm happy to test further!
Comment #36
drewish commentedHorsePunchKid, that patch was for HEAD, not -dev (which is the DRUPAL-5 branch). either wait until the new -dev release is up or just grab the patched version of the module on comment #22.
Comment #37
drewish commentedWrath-BRIG-, see http://drupal.org/patch for information on applying patches.
Comment #38
drewish commentedafter some more testing i've committed #34 to HEAD. i'm going to mark this as fixed. if people can try out the updated releases when they post i'd appreciate it.
Comment #39
HorsePunchKid commentedI'm still seeing the same behavior, though now I get a convenient link to the regenerated image with every displayed message. This is for image-5.x-1.x-dev timestamped 2007-09-05 00:03. Perhaps I can temporarily just disable rebuilding derivatives, since I'm not uploading new images frequently...
Comment #40
HorsePunchKid commentedI have upgraded to
image-5.x-1.x-devposted 12-Sep-2007 12:06, and things seem to be working smoothly.Comment #41
(not verified) commented