[dev] Crushing temp file generation in Turba Objects

Michael J Rubinsky mrubinsk at horde.org
Tue Oct 25 17:15:21 UTC 2011


Quoting Michael J Rubinsky <mrubinsk at horde.org>:

> Quoting Michael M Slusarz <slusarz at horde.org>:
>
>> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>>
>>> Quoting Jan Schneider <jan at horde.org>:
>>>
>>>> Zitat von Michael M Slusarz <slusarz at horde.org>:
>>>>
>>>>> What does this code do in Turba_Object#getValue() (line 110-17)?
>>>>>
>>>>>        return empty($this->attributes[$attribute])
>>>>>             ? null
>>>>>             : array(
>>>>>                   'load' => array(
>>>>>                       'data' => $this->attributes[$attribute],
>>>>>                       'file' =>  
>>>>> basename(Horde::getTempFile('horde_form_', false))
>>>>>                   )
>>>>>               );
>>>>>
>>>>> Initializing a compose window causes 100's of empty temp files  
>>>>> to be created in the system temp directory - this occurs when  
>>>>> the contact autocompletion code is initialized.  These files are  
>>>>> created once a session.  After a weeks worth of logins, I have  
>>>>> 5,000+ of these temp files, that are never cleaned up.  This is  
>>>>> not good.
>>>>
>>>> This problem was explicitly mentioned in the commit message:  
>>>> http://git.horde.org/horde-git/-/commit/3a6dae7dab4c44fce7e283bd0c0ed4489808851a
>>>
>>> Not sure what the solution is for this yet either. Essentially, we  
>>> need a mechanism to allow for deleting temporary files at the end  
>>> of the *session*, not at shutdown. Either that, or a complete  
>>> refactor of the Horde_Form_Image type.
>>
>> What's the purpose of the files though?  Is it supposed to contain  
>> image data?  Because all I get are hundreds of 0-length files.
>
> I don't remember the exact code path (the code took me some time to  
> trace/understand and that was a bit ago), but those files are used  
> by Horde_Form when adding a photo to the contact. The problem is  
> that the request to display the <img> tag is a *different* request  
> from the one that saves the image so if the tmp file is removed, by  
> the time the img request is made, the file is gone. See Bug: 10050  
> and Bug: 10035.
>
> What I don't understand is why 0b files are being created when the  
> compose window is created (I see this too). Normally, the tmp files  
> would only be created when viewing a contact with a photo. I have  
> verified this is what happens when using Turba directly - and in  
> these cases they are actual valid image files. I also remember why 3  
> tmp files are created for each view - but that sounds familiar, and  
> I kinda remember trying to fix that and not being able to because of  
> the way the image form type worked.



I should add that I probably won't have time in the next few days to  
look at this, but if nobody else does so before then, I'll try to look  
at it over the weekend.

-- 
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org



More information about the dev mailing list