When profiling_inferred_spans_enabled is enabled java throws the following exception when closing a filestream:
java.io.IOException: Input/output error at java.io.FileOutputStream.close0(Native Method) at java.io.FileOutputStream.access$000(FileOutputStream.java:53) at java.io.FileOutputStream$1.close(FileOutputStream.java:356) at java.io.FileDescriptor.closeAll(FileDescriptor.java:212) at java.io.FileOutputStream.close(FileOutputStream.java:354)
(observe that the exception is thrown from a native method, suggesting that the async-profiler is the cause as it instruments native methods)
The APM java documentation says that infered_spans is not supported on Windows because the async-profiler dependency does not support windows. My 'problem' was that I used APM on a weblogic server on Linux but the IOException occurs when i close a filestream on a linux directory that is mapped to a network storage with Windows OS.
Disabling profiling_inferred_spans seems to fix the issue because then the async-profiler is not being used anymore.
I think it would be good to include in the documentation that profiling_inferred_spans_enabled is not compatible when files are written to a linux directory that is mounted to a windows attached network storage. Even if your own application is running on linux.