Upload Error of Images xwiki jetty

Hello,
i’ve newly installed xwiki on a debian machine. The problem i have: Image Uploads for a Page result into an error:


[XWiki Solr index thread] ERROR .DocumentSolrMetadataExtractor - Failed to retrieve the content of attachment [Attachment xwiki:Main.WebHome@1739783084018-385.png]
org.apache.tika.exception.TikaException: image/png parse error
at org.apache.tika.parser.image.ImageParser.extractMetadata(ImageParser.java:205)
at org.apache.tika.parser.image.AbstractImageParser.parse(AbstractImageParser.java:79)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:298)
at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:298)
at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:203)
at org.apache.tika.Tika.parseToString(Tika.java:525)
at org.apache.tika.Tika.parseToString(Tika.java:495)
at org.xwiki.tika.internal.TikaUtils.parseToString(TikaUtils.java:153)
at org.xwiki.search.solr.internal.metadata.AbstractSolrMetadataExtractor.getContentAsText(AbstractSolrMetadataExtractor.java:534)
at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setAttachment(DocumentSolrMetadataExtractor.java:333)
at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setAttachments(DocumentSolrMetadataExtractor.java:313)
at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setExtras(DocumentSolrMetadataExtractor.java:239)
at org.xwiki.search.solr.internal.metadata.DocumentSolrMetadataExtractor.setFieldsInternal(DocumentSolrMetadataExtractor.java:152)
at org.xwiki.search.solr.internal.metadata.AbstractSolrMetadataExtractor.getSolrDocument(AbstractSolrMetadataExtractor.java:171)
at org.xwiki.search.solr.internal.DefaultSolrIndexer.lambda$getSolrDocument$0(DefaultSolrIndexer.java:615)
at org.xwiki.bridge.internal.DefaultDocumentContextExecutor.call(DefaultDocumentContextExecutor.java:65)
at org.xwiki.search.solr.internal.DefaultSolrIndexer.getSolrDocument(DefaultSolrIndexer.java:615)
at org.xwiki.search.solr.internal.DefaultSolrIndexer.processBatch(DefaultSolrIndexer.java:504)
at org.xwiki.search.solr.internal.DefaultSolrIndexer.run(DefaultSolrIndexer.java:466)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: javax.imageio.IIOException: Error reading PNG metadata
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:918)
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.getImageMetadata(PNGImageReader.java:1840)
at org.apache.tika.parser.image.ImageParser.extractMetadata(ImageParser.java:187)
... 19 common frames omitted
Caused by: javax.imageio.IIOException: Invalid chunk length 0
at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:792)
... 21 common frames omitted

i am quite puzzled why this is happening, because i don’t find any similiar issues on the board.

Browser: Microsoft Edge Version 133.0.3065.69
Server: Debian GNU/Linux 12 (bookworm)
XWiki Installation: XWiki repository: xwiki-xjetty-mariadb (stable,now 17.0.0+1 all)

The error seems to be related to the indexing of the image and not so much its upload. Can you access and see that image you uploaded (from the page attachments tab, for example) ?

i am able to see the uploaded images, but only like 30 pixels height.

when i try to look at a image, the log got one more entry:

2025-02-18 15:30:58,124 [qtp1117509763-298 - http://wiki-server:8080/xwiki/bin/download/Main/WebHome/1739888843345-451.png?width=48&rev=1.1] WARN  c.x.x.p.i.ImagePlugin          - Failed to transform image attachment [1739888843345-451.png] for scaling, falling back to original attachment. Root error: [EOFException: ]
2025-02-18 15:31:04.575:WARN :oejes.DefaultServlet:qtp1117509763-285: Incorrect mapping for DefaultServlet at /favicon.ico. Use ResourceServlet

And I assume you don’t have that problem with the image file you have locally ?

It sounds like your image was only partially uploaded for some reason, but hard to tell why. Do you have any error or warning related to the actual thread which uploaded that image (some before the tika related one you pasted) ?

the image files are not fully uploaded, if i look for them in the filesystem, they are also cut at the top, the rest is filled with the alpha channel on zero (*.png).

The same images on the computer i upload to the wiki with, are in the sRGB color space.

in this try, i tried to upload a *.jpg . this is the first error i find in the log with the image as reference:

2025-02-18 16:06:57,700 [XWiki Solr index thread] ERROR ttachmentSolrMetadataExtractor - Failed to retrieve the content of attachment [Attachment xwiki:Main.WebHome@Test_Portrait_Alpha.jpg] 
org.apache.tika.exception.TikaException: TIKA-198: Illegal IOException from org.apache.tika.parser.image.JpegParser@6fe50755
	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:304)
	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:298)
	at org.apache.tika.parser.AutoDetectParser.parse(AutoDetectParser.java:203)
	at org.apache.tika.Tika.parseToString(Tika.java:525)
	at org.apache.tika.Tika.parseToString(Tika.java:495)
	at org.xwiki.tika.internal.TikaUtils.parseToString(TikaUtils.java:153)
	at org.xwiki.search.solr.internal.metadata.AbstractSolrMetadataExtractor.getContentAsText(AbstractSolrMetadataExtractor.java:534)
	at org.xwiki.search.solr.internal.metadata.AttachmentSolrMetadataExtractor.setLocaleAndContentFields(AttachmentSolrMetadataExtractor.java:114)
	at org.xwiki.search.solr.internal.metadata.AttachmentSolrMetadataExtractor.setFieldsInternal(AttachmentSolrMetadataExtractor.java:93)
	at org.xwiki.search.solr.internal.metadata.AbstractSolrMetadataExtractor.getSolrDocument(AbstractSolrMetadataExtractor.java:171)
	at org.xwiki.search.solr.internal.DefaultSolrIndexer.lambda$getSolrDocument$0(DefaultSolrIndexer.java:615)
	at org.xwiki.bridge.internal.DefaultDocumentContextExecutor.call(DefaultDocumentContextExecutor.java:65)
	at org.xwiki.search.solr.internal.DefaultSolrIndexer.getSolrDocument(DefaultSolrIndexer.java:615)
	at org.xwiki.search.solr.internal.DefaultSolrIndexer.processBatch(DefaultSolrIndexer.java:504)
	at org.xwiki.search.solr.internal.DefaultSolrIndexer.run(DefaultSolrIndexer.java:466)
	at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.io.EOFException: End of data reached.
	at com.drew.lang.StreamReader.getByte(StreamReader.java:62)
	at com.drew.lang.SequentialReader.getInt8(SequentialReader.java:148)
	at com.drew.imaging.jpeg.JpegSegmentReader.readSegments(JpegSegmentReader.java:125)
	at com.drew.imaging.jpeg.JpegMetadataReader.process(JpegMetadataReader.java:124)
	at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata(JpegMetadataReader.java:77)
	at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata(JpegMetadataReader.java:93)
	at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata(JpegMetadataReader.java:104)
	at org.apache.tika.parser.image.ImageMetadataExtractor.parseJpeg(ImageMetadataExtractor.java:119)
	at org.apache.tika.parser.image.JpegParser.extractMetadata(JpegParser.java:56)
	at org.apache.tika.parser.image.AbstractImageParser.parse(AbstractImageParser.java:79)
	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:298)
	... 15 common frames omitted

The Errors before in the log:

2025-02-18 16:06:46,948 [qtp1117509763-311 - http://geo-wiki01:8080/xwiki/bin/download/Main/WebHome/1739783539231-925.png?width=150&height=150&keepAspectRatio=true] WARN  c.x.x.p.i.ImagePlugin          - Failed to transform image attachment [1739783539231-925.png] for scaling, falling back to original attachment. Root error: [EOFException: ] 
2025-02-18 16:06:46,946 [qtp1117509763-19 - http://geo-wiki01:8080/xwiki/bin/download/Main/WebHome/1739783087811-863.png?width=150&height=150&keepAspectRatio=true] WARN  c.x.x.p.i.ImagePlugin          - Failed to transform image attachment [1739783087811-863.png] for scaling, falling back to original attachment. Root error: [EOFException: ] 
2025-02-18 16:06:46,956 [qtp1117509763-23 - http://geo-wiki01:8080/xwiki/bin/download/Main/WebHome/1739783518009-854.png?width=150&height=150&keepAspectRatio=true] WARN  c.x.x.p.i.ImagePlugin          - Failed to transform image attachment [1739783518009-854.png] for scaling, falling back to original attachment. Root error: [EOFException: ] 
2025-02-18 16:06:46,953 [qtp1117509763-318 - http://geo-wiki01:8080/xwiki/bin/download/Main/WebHome/1739783084018-385.png?width=150&height=150&keepAspectRatio=true] WARN  c.x.x.p.i.ImagePlugin          - Failed to transform image attachment [1739783084018-385.png] for scaling, falling back to original attachment. Root error: [EOFException: ] 
2025-02-18 16:06:46,958 [qtp1117509763-285 - http://geo-wiki01:8080/xwiki/bin/download/Main/WebHome/1739888843345-451.png?width=150&height=150&keepAspectRatio=true] WARN  c.x.x.p.i.ImagePlugin          - Failed to transform image attachment [1739888843345-451.png] for scaling, falling back to original attachment. Root error: [EOFException: ] 

all of these images have the same problem, i guess, because they are not fully uploaded and don’t fit to the expectation of the image parser.

are there other logs besides /var/log/xwiki ?

In my opinion, the upload definitely gets interrupted but xWiki does not complain and tells me, its successful. The resulting (readable) errors seem to result in corrupted files - .png being uploaded like 1/10th and .jpg totally failing.

Not the best solution, but because the logs were not verbose enough for me :
i’ve overwritten the server with ubuntu (the debian was a fresh install too, so it’s not a huge pain) to be able to have tomcat10 instead of jetty.

so maybe there is a well-hidden bug in jetty or the jetty-variant and maybe a bug in xWiki, not detecting a bad file transfer?

should i report something? I may try to reproduce it, when i have free time :sweat_smile:

Uploading in general work well with Jetty+XWiki for sure. Would need to reproduce and debug exactly what is happening.

It would be great to create an issue on Loading..., yes, with as much detail as you can find to reproduce the problem.

Hello,
Is there any new information regarding this problem? I am facing the same issue and it is driving me nuts. Is there a JIRA entry? I could not find any.
Thanks!

Hi, we have the same problem. Today I did the update to 17.2.0.

ii  xwiki-common                    17.2.0
ii  xwiki-mariadb-common            17.2.0
ii  xwiki-xjetty-common             17.2.0
ii  xwiki-xjetty-mariadb            17.2.0

This a current Debian 12 system.

Now I have one method to insert a picture that works and one that does not.

(My reference here is an installation with german localisation, so my
translation of menu items is probably dubious)

not working

While editing a page I click on the insert picture icon in the menu bar,
choose the tab upload, click on browse, select an image, press the upload
button and click on select. Then I see the edit image dialog and just
click on insert.

Result is a picture that is broken just after the first few lines.

working

Opening the attachments menu of a page, where I would also delete the broken
images from earlier tests and using the attach files to this document function
at the bottom of the page. I simply click browse, select an image, see it
getting uploaded an then see the image with a correct thumbnail in the list of
attachments. I then click on edit on the top of the page, can edit the page,
select the insert image icon in the menu bar, see my image in the gallery
tab, select it, see the edit image dialog, click insert and have an unbroken
picture in the page.

So at least there is a workaround!

@tmortagne What info would you need that would help to check this out?

1 Like

Thanks for the details. I do indeed reproduce this with the xjetty demo package. I created Loading..., and we’ll work on it ASAP, it’s a pretty serious regression, sorry for the inconvenience.

1 Like

I just installed the latest update and can confirm that it works now as expected.

@tmortagne & @MichaelHamann Thank you very much for your quick help!