Opened 15 years ago
Closed 15 years ago
#12457 closed (duplicate)
"IOError: Too many open files" when pulling height and width values from a long list of ImageField containing Model objects.
Reported by: | legutierr | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | Keywords: | "Too many open files" | |
Cc: | legutierr | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
It appears as if ImageField.width and ImageField.height both open the referenced image file without closing it, resulting in the above mentioned IOError.
The behavior is induced as follows: I have a long list of objects, and I am trying to pull out the size of the images that they reference. After a certain point is reached, the IOError is raised when model_object.image_field.width is accessed and assigned.
This is taking place in OSX Server Leopard running fastcgi and apache, but I am sure that it would occur in other configurations as well.
I determined the nature of the problem by stepping through the code using pdb. In fastcgi the exeption is caught and obfuscated. Instead of the IOError being displayed, the following message is printed out directly by fastcgi, without any further information:
"An unhandled exception was thrown by the application."
Dupe of #8817.