There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-6dd8c3c7-a597-4577-a613-f724ae86baff XWIKI-24350 Open

Temporary attachment files not closed during XAR import

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-b2b71baf-0456-4d81-829c-44fdcdc99eab Changes by Michael Hamann on 13/May/26 15:36
 
Description: *Steps to reproduce:*

Preparation (not necessary to reproduce the bug):

# Create a page with an attachment that is sufficiently large (at least 1 MB to be sure)
# Export the page as a XAR archive
# Go to Content -> Import in the admin area
# Upload the exported XAR

Reproduction:
# Run {{readlink -f /proc/$PID/fd/* 2>/dev/null | grep deleted}} or another command for getting open files, filtering for deleted files.
# Import the exported XAR
# Immediately re-run {{readlink -f /proc/$PID/fd/* 2>/dev/null | grep deleted}} or another command for getting open files, filtering for deleted files.

*Expected result:*

There are no deleted open files reported
, neither before nor after the import .

*Actual result:*

There are After the import, there is at least one deleted open files file like {{attachment14823327115021904565.bin (deleted)}} inside the Servlet container's temporary directory.

The reason for this is that the output stream to which the attachment is written temporarily is never closed. During garbage collection, those files are eventually closed by the JDK, making it unlikely to have a bigger impact unless you're running huge imports with a lot of attachments on a system without much garbage collection pressure. The code for that was introduced in XWIKI-13950.