I download an imagefile with CURL, to a temp directory/file,
and then field_file_save_file the image to a cck imagefield, with this copying it to a permanent location.
After these steps the file on the permanent location is incomplete, but the file in the temp directory is complete.
This only happens in the virtual machine, on a real machine it works fine.
I'm thinking this could be some sort of a caching problem: It may be so that when I save the file to it's permanent location it seems not yet completely available in the temp file location.
Big image files (5 MB) don't seem to have this problem, small files do. Very small files don't even seem to be written from temp to permanent directory at all.
Anyone got any ideas of how to solve this? I'm almost at the point of tearing my hair out :(
Any help would be appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | quickstart_dev_module.zip | 8.38 KB | silkogelman |
Comments
Comment #1
silkogelman commentedI did not manage to tackle this problem yet.
I am hoping it is some kind of Virtualbox caching problem, I just don't get it.
This only happens in Virtualbox / Quickstart.
Comment #2
rfay@s1l, I think you're going to have to give a complete demonstration/replication example to get this solved.
Can you combine a script and a module that shows it? Simple, demonstration script or code? No extra fluff related to your application, just a straightforward demonstration of this problem?
Comment #3
silkogelman commentedIt's a quite specific problem, so for you to easily replicate the problem I created a small module.
Attached is the module and the 'quickstart' content type in a text file.
installation:
first enable the module (it needs cck & imagefield), then import the content type with CCK's Content Copy (the import/export thingy)
at http://example.com/admin/settings/quickstart you will have an admin menu.
On the bottom of that admin menu is a button that says 'Curl Download image and insert into imagefield'.
It creates a node of the content type 'quickstart' and inserts the image into its imagefield.
when looking at the created node, you will notice that
http://drupal.org/files/images/stock-car-racing-techniques-1.jpg
will be inserted into the imagefield, but is not complete. However it will be fully available in the /tmp folder (maybe a fraction of a second later)
With the 'Quickstart Dev Settings' on /admin/settings/quickstart you can change what imagefile will be downloaded (don't forget to hit save)
http://drupal.org/sites/all/themes/bluebeach/logos/drupal.org.png
will give this error:
"The selected file 1284206792-drupal.org.png could not be saved. The file is not a known image format."
probably because it's not fully written to the hdd at the moment it is saved to the imagefield.
Comment #4
MichaelCole commentedHi s1l,
I'm not totally sure on how to debug this. rfay may have some better suggestions.
If I was to work on it, I'd use xdebug and step through the code. If you can verify it's a timing issue that's a big step forward.
As a timing issue, it's notoriously hard to debug and fix (you need someone who knows the code). You might have better luck in the CCK or imagefield groups - any resolution will have probably involve them. Are there any timing issues in those issue queues?
If they want to reproduce it, they can install Quickstart, or check out the exact config through the build scripts in cvs.
Wish I could be more help, anyone else?
Mike
Comment #5
MichaelCole commentedHi s1l,
I'm not totally sure on how to debug this. rfay may have some better suggestions.
If I was to work on it, I'd use xdebug and step through the code. If you can verify it's a timing issue that's a big step forward.
As a timing issue, it's notoriously hard to debug and fix (you need someone who knows the code). You might have better luck in the CCK or imagefield groups - any resolution will have probably involve them. Are there any timing issues in those issue queues?
If they want to reproduce it, they can install Quickstart, or check out the exact config through the build scripts in cvs.
Wish I could be more help, anyone else?
Mike
Comment #6
MichaelCole commentedHi s1l,
I'm not totally sure on how to debug this. rfay may have some better suggestions.
If I was to work on it, I'd use xdebug and step through the code. If you can verify it's a timing issue that's a big step forward.
As a timing issue, it's notoriously hard to debug and fix (you need someone who knows the code). You might have better luck in the CCK or imagefield groups - any resolution will have probably involve them. Are there any timing issues in those issue queues?
If they want to reproduce it, they can install Quickstart, or check out the exact config through the build scripts in cvs.
Wish I could be more help, anyone else?
Mike
Comment #7
rfay@s1l, the reality is that you should try your testing on a plain vanilla Debian/Ubuntu machine. CPanel is a pretty unusual and altered environment, and you may be reporting an operating system issue here, not an issue with Quickstart. I will give it a try since you gave so much information, if I get a chance.
If you want to try it out on plain vanilla Debian/Ubuntu, just create a new Ubuntu instance in your Virtualbox by downloading the Ubuntu install and installing. There is lots of info on how to configure an instance at places like this: http://drupal.org/node/157602.
You may very well have something too permissive or unusual on your CPanel setup.
Comment #8
silkogelman commentedThanks for the input guys!
Let me be clear that I don't use cpanel in the Quickstart environment.
I use Quickstart unaltered, just like it is provided by Michael.
I do have another Cpanel server 'on the web'.
In that Cpanel config it all works fine. In my local Quickstart 0.6 in the Virtualmachine it does not.
How does the small module I made behave in your Quickstart environments?
I'm not sure if testing on a plain Ubuntu Virtual machine will help solve the problem, because I am under the impression that the Quickstart project is just that.
I'll try to get xdebug installed in Quickstart and will search the other issue queues for possible answers.
First I'll test this issue under Quickstart 0.7.
Comment #9
rfayHi - My point was that the Debian/Ubuntu install provided by quickstart is more "normal" than Cpanel. So you should try a default debian/ubuntu.
Comment #10
MichaelCole commentedHi S1l,
QS 0.6 comes ootb with xdebug enabled. Start up netbeans and you should be able to debug already.
QS 0.7 comes with xdebug, but it needs an extra line in xdebug.ini to get going.
echo "zend_extension=/usr/lib/php5/20090626+lfs/xdebug.so" | sudo tee -a /etc/php5/conf.d/xdebug.ini
Should do the trick. I plan to re-roll a QS with this fix shortly (next week or so)
Comment #11
silkogelman commentedProblem solved: in Quickstart 0.7 this problem doesn't occur anymore!
Thanks for the help Michael & Randy!
Comment #12
MichaelCole commentedIt may be a PHP 5.2 (QS 0.6) vs PHP 5.3 (QS 0.7) thing...
Comment #13
silkogelman commentedI think you're right, my production server also runs 5.3
Comment #14
MichaelCole commentedGroovy S1l,
If you think that's the case, the module maintainers might appreciate an issue filed about it.
They may have upgraded compatibility to 5.3 and didn't know that they broke 5.2.
Just a thought,
Mike
Comment #15
MichaelCole commentedComment #16
silkogelman commentedGood idea Mike.
However I am not sure if this is a Filefield / Imagefield problem, because when I test this with a file that is already on the hdd (so no Curl download before image2Imagefield import) it works fine in PHP 5.2.
So it seems (in the Curl case) the file is not completely written to the hdd and then sent to Imagefield/Filefield as an input.
I think this is a Curl/PHP problem, and it was solved somewhere between PHP 5.2 and 5.3
Comment #17
MichaelCole commented