What happens
ImportTask.runTask() calls importConfig.close() after the outer try/finally (
), so it runs only when the method falls through on success. Every error return — disable failed (
:650), lock not acquired (
:661,
:669),
importLDIF threw (
:690,
:697), lock not released (
:709,
:717), re-enable failed (
:747) — bypasses it.
LDIFImportConfig.close() is what closes the LDIF reader and the rejected-entries and skipped-entries writers the task opened at :594-620. On a failed import they stay open and unflushed, and importConfig is a field that the next run of the task overwrites, so nothing else ever closes them.
Consequence
- The rejects file — the artefact an operator reads after a failed import — can be missing its buffered tail.
- File handles leak per failed import for the life of the server.
- On Windows the open handle blocks a subsequent run of the same task with
ds-task-import-reject-file pointing at the same path.
Fix
Move importConfig.close() into the outer finally (its own try, before the listener notification), leaving the returns where they are.
Pre-existing, unchanged by #969; found while reviewing it.
What happens
ImportTask.runTask()callsimportConfig.close()after the outertry/finally(OpenDJ/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
Line 752 in 7850557
:650), lock not acquired (:661,:669),importLDIFthrew (:690,:697), lock not released (:709,:717), re-enable failed (:747) — bypasses it.LDIFImportConfig.close()is what closes the LDIF reader and the rejected-entries and skipped-entries writers the task opened at:594-620. On a failed import they stay open and unflushed, andimportConfigis a field that the next run of the task overwrites, so nothing else ever closes them.Consequence
ds-task-import-reject-filepointing at the same path.Fix
Move
importConfig.close()into the outerfinally(its owntry, before the listener notification), leaving the returns where they are.Pre-existing, unchanged by #969; found while reviewing it.