Me and my coworkers have been trying to track down a bug which has had us scratching our heads for a while. We have finally figured out that it seems to stem from search_api so I figured I'd make a bugreport here.
The bug in short: With search_api enabled uploading images to articles doesn't seem to work. When you try to upload a file it doesn't show up on the standard article contenttype, however if you save the article you'll find that the image was indeed saved to the article. After some digging we found that it seems to crash in your entity_insert hook around line 581 after the call to search_api_index_load_multiple. The arguments this function runs with are $ids = false, $conditions = array('enabled' => 1, 'entity_type' => file, 'read_only' => 0) and $reset = false.
To try and rule out all other modules I installed a fresh drupal 7.0 site with only search_api and it's requirements enabled (but not search pages, indexes or server set up). Then I tried to upload an image to an article which failed. Afterwards I installed the newest stable release of D7 using drush and performed the same test which also failed.
Is there something I've overlooked or is this a bug?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1190086--hook_entity_insert.patch | 463 bytes | drunken monkey |
Comments
Comment #1
drunken monkeyOK, that's really weird. I can't really imagine what would go wrong at this point.
Do you have an index on File entities?
Does it fail before, in, or after this call? Since I can't reproduce this, you've got to help me there.
Also: Does this only occur when you upload the image by pressing "Upload" next to the image, or also when you select the file and then just save the node form? In the latter case, what kind of error do you get?
Lastly, does the attached patch help, by any chance?
Comment #2
kimpil commentedWe thought it was rather strange as well.
No this test site I set up do not have any indexes set up. All I did was enable the module, we had the same bug on sites where we did have servers and indexes as well.
It fails somewhere within the search_api_index_load_multiple function, I'm not currently at a computer where I can access the code but since it's a one-line function that means that it crashes in that one line :)
It only occurs when I press the "Upload" button, if I just save the node form I don't notice anything going wrong. The interesting part is that I do not get any error messages, when I press the "Upload" button it loads for a short while and then does nothing.
I did try and install the patch which did seem to clear up the issue. When I get back to work tomorrow I may be able to do some further testing to see if everything behaves as it should.
Since I'm at home at the moment this post may be a bit sparse on important details, but if there are anything I can do to help I'll be keeping an eye on this thread while I do my work. If I think of something else which may help you reproduce it then I'll off course get back to you, I'll probably try and do a fresh install on another computer to check if I can reproduce it there as well.
Comment #3
drunken monkeyIf the patch helps, this is related to a very weird PDO bug which also popped up in the Search pages module a while ago. See #889286: EntityAPIController::load() produces WSoD sometimes with PHP 5.2.
Comment #4
kimpil commentedThanks for your help it seems that the patch did indeed solve the issue on our end. I'm new around these parts, which status would be most appropriate for this bug-report now?
Comment #5
drunken monkeyI now commit the bug fix and then set the status to "fixed" myself. Before, if a proposed patch resolved an issue for you, you can set the status to "reviewed & tested by the community".
Good to know this solves it, even though it's still a disturbingly weird bug fix.
Comment #6
kimpil commentedThanks that's good to know for future reference.
Me and my coworkers will give this a more thorough test sometime next week. If we find that the bug hasn't been fixed or the fix has had unfortunate side effects I'll post here again. I somehow doubt that the call to the searchapiindex constructor should have any side effects. But this bug has had a nature of disappearing and reappearing which means I'm hesitant to conclude that it is really gone.
I agree that this bug fix is rather weird, from my tests the bug doesn't show up if you use php 5.3.3. At least everything worked fine when I set it up on my laptop.
Comment #7
drunken monkey