Some questions about the JfrBuffer flush mechanism
Denghui Dong
denghui.ddh at alibaba-inc.com
Tue Nov 12 09:42:59 UTC 2019
Hi team,
There is a moment that a thread A writes event data to it's thread-local
Jfrbuffer, and other thread B flushes the content of the JfrBuffer to
file concurrently.
The pos of the JfrBuffer will be updated by the thread A after an event is
written done(jfrStorageAdapter.hpp commit),
the thread B will flush the content between the top and pos of the
JfrBuffer(jfrStorage.cpp ThreadLocalConcurrentWriteOperation).
The question is how to ensure that the content flushed by the thread B is correct.
There is no release store when the thread A updates the value of pos,
and no load acquire when the flush thread read the value of pos.
So is it possible that the thread B reads the new value of pos, but can't read the correct value
between the top and pos of the JfrBuffer.
My platform is x86-64 (tso), so I can't write a case to verify it.
Thanks,
Denghui Dong
More information about the hotspot-jfr-dev
mailing list