Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8274315

JFR: One closed state per file or stream

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 18
    • None
    • hotspot
    • None
    • jfr
    • b30

        Numerous JFR streaming tests have timed out sporadically, for example TestOnEvent. One possible reason for the timeouts could be the closed state of a stream not being propagated.

        When a user calls EventStream::close(), both the ChunkParser and the underlying stream, for example RecordingStream, must be closed. Today this is handled by a volatile boolean field in both the stream class and the ChunkParser class. When a new chunk is being parsed, a new instance of the ChunkParser is instantiated with the closed field set to false.

        There is a potential risk that the call EventStream::close() can happen on an old instance of the ChunkParser which could leave the parser thread stuck in ChunkParser::awaitUpdatedHeader(...) waiting for the closed state being true.

        The solution is to have one closed state per recording file or stream. This can be implemented using an AtomicBoolean that is instantiated once and passed around. When it is flipped, it will be seen by all the subsystems.

        If it turns out that timeouts in tests disappear after this bug has been fixed, those test bugs can be closed as duplicates. If not, something else is going on that needs further investigation.

              egahlin Erik Gahlin
              egahlin Erik Gahlin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: