-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 5.7.2, 5.8.0-HF02
-
Fix Version/s: 5.9.2
-
Component/s: Image Management
Originally reported at: http://answers.nuxeo.com/questions/6046/cant-generate-picture-thumbnails
In certain (unknown) circumstances, Nuxeo servers can start to fail generating thumbnails, because of the following error:
2013-06-25 17:55:31,655 ERROR [org.nuxeo.ecm.core.work.AbstractWork] Exception during work: PictureViewsGenerationWork(RUNNING, Progress(0.0%, ?/0), null) org.nuxeo.ecm.core.api.ClientException: Failed to save document DocumentModelImpl(649ce38e-92f6-4d7f-9c49-432fb874b97b, path=/asset-library/Test Thumb, title=Test Thumb) at org.nuxeo.ecm.core.api.AbstractSession.saveDocument(AbstractSession.java:1989) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.nuxeo.ecm.core.api.TransactionalCoreSessionWrapper.invoke(TransactionalCoreSessionWrapper.java:133) at com.sun.proxy.$Proxy44.saveDocument(Unknown Source) at org.nuxeo.ecm.platform.picture.PictureViewsGenerationWork.work(PictureViewsGenerationWork.java:45) at org.nuxeo.ecm.core.work.AbstractWork.run(AbstractWork.java:164) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722) Caused by: org.nuxeo.ecm.core.api.DocumentException: org.nuxeo.ecm.core.storage.StorageException: java.io.IOException: Stream Closed at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.getBinary(SQLSession.java:1154) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLContentProperty.setValue(SQLContentProperty.java:80) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLComplexProperty.setValue(SQLComplexProperty.java:101) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLComplexListProperty.setList(SQLComplexListProperty.java:278) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLComplexListProperty.setValue(SQLComplexListProperty.java:86) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLComplexProperty.setPropertyValue(SQLComplexProperty.java:222) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentLive.writeDocumentPart(SQLDocumentLive.java:178) at org.nuxeo.ecm.core.api.DocumentModelFactory.writeDocumentModel(DocumentModelFactory.java:298) at org.nuxeo.ecm.core.api.AbstractSession.writeModel(AbstractSession.java:541) at org.nuxeo.ecm.core.api.AbstractSession.saveDocument(AbstractSession.java:1961) ... 11 more Caused by: org.nuxeo.ecm.core.storage.StorageException: java.io.IOException: Stream Closed at org.nuxeo.ecm.core.storage.sql.SessionImpl.getBinary(SessionImpl.java:315) at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.getBinary(ConnectionImpl.java:161) at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.getBinary(SQLSession.java:1152) ... 20 more Caused by: java.io.IOException: Stream Closed at java.io.FileInputStream.available(Native Method) at org.nuxeo.ecm.core.storage.sql.AbstractBinaryManager.storeAndDigest(AbstractBinaryManager.java:97) at org.nuxeo.ecm.core.storage.sql.LocalBinaryManager.storeAndDigest(LocalBinaryManager.java:176) at org.nuxeo.ecm.core.storage.sql.LocalBinaryManager.getBinary(LocalBinaryManager.java:114) at org.nuxeo.ecm.core.storage.sql.SessionImpl.getBinary(SessionImpl.java:313) ... 22 more
Once the error starts occurring, it happens every time a picture is uploaded, and even restarting Nuxeo doesn't help. The only time I saw the error disappear for a while is when upgrading a server from 5.7.1 to 5.7.2.
I figured out that the bug is linked to the use of an InputStreamBlob, created to store temporarily the original picture ; the blob is somehow broken when time comes to save the document (maybe the stream is read before?).
I hacked the bug by overriding the PictureViewListener + PictureViewsGenerationWork, replacing the blob right after the thumbnails generation:
... picture.fillPictureViews(blob, filename, title, pictureTemplates); // Fix original picture String originalContentXpath = picture.getViewXPath("Original") + "content"; Serializable originalContent = workingDocument.getPropertyValue(originalContentXpath); if (originalContent instanceof InputStreamBlob) { InputStreamBlob originalContentBlob = (InputStreamBlob) originalContent; Blob persistedBlob = originalContentBlob.persist(); workingDocument.setPropertyValue(originalContentXpath, (Serializable) persistedBlob); }
For full disclosure, I only experienced these bugs with a customized Nuxeo, with changes made to DAM for instance. But I don't think we did anything that could impact the thumbs generation.
- is duplicated by
-
NXP-13603 Picture thumbnails are not generated when Nuxeo Quota is installed
- Resolved