Skip to content

[disk-buffering] Duplicate export in Windows #1907

Closed
@jigarkb

Description

@jigarkb

Component(s)

disk-buffering

What happened?

Description

On Windows systems, the exportStoredBatch method returns true when a file exists in the buffer directory. However, once the file is fully read, the subsequent file.delete() call in cleanUp() fails silently—returning false but not handled by the code. As a result, the same file is repeatedly re-exported on each exportStoredBatch call until a new file is written, leading to redundant exports and significant load on backend APIs.

This behavior appears linked to how Windows handles file deletion. After file.delete() is called, the file’s metadata may reflect 0KB, but the contents persist until a subsequent I/O operation (e.g., file creation) triggers actual cleanup. This suggests possible lazy deletion by the Windows OS, though further investigation at the kernel level would be needed to confirm.

Reference: https://github.com/open-telemetry/opentelemetry-java-contrib/blob/v1.39.0/disk-buffering/src/main/java/io/opentelemetry/contrib/disk/buffering/internal/storage/files/ReadableFile.java#L124-L127

Steps to Reproduce

Deploy your code on Windows with debugEnabled set to true, and you'll consistently see the message Now exporting batch of ... repeated.

Expected Result

The file must be deleted and should not be re-exported.

Actual Result

The file is repeatedly processed and exported.

Component version

v1.39.0

Log output

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions