Skip to content

Conversation

@vpa1977
Copy link

@vpa1977 vpa1977 commented Oct 28, 2025

jtharness does not synchronize calls to Observer. Synchronized keyword needs to be added when processing shared state.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • CODETOOLS-7904105: intermittent test failure in CleanupDirTests.agentvm.conc (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jtreg.git pull/297/head:pull/297
$ git checkout pull/297

Update a local copy of the PR:
$ git checkout pull/297
$ git pull https://git.openjdk.org/jtreg.git pull/297/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 297

View PR using the GUI difftool:
$ git pr show -t 297

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jtreg/pull/297.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 28, 2025

👋 Welcome back vpetko! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 28, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@vpa1977 vpa1977 marked this pull request as ready for review October 28, 2025 04:12
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 28, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 28, 2025

Webrevs

@jaikiran
Copy link
Member

Hello Vladimir, we have seen intermittent failure in this test too, but i haven't had a chance to look deeper.

TestStats deals with counts in several different methods, so I'm not completely sure the proposed change is enough or the best way to address this. It may be that the code in TestStats itself might need to be addressed in some manner.

@vpa1977
Copy link
Author

vpa1977 commented Oct 28, 2025

Hello Vladimir, we have seen intermittent failure in this test too, but i haven't had a chance to look deeper.

TestStats deals with counts in several different methods, so I'm not completely sure the proposed change is enough or the best way to address this. It may be that the code in TestStats itself might need to be addressed in some manner.

Hi,

I have tried using atomics in TestStats and the implementation looked ugly / required a lot of refactoring.

jtreg only updates counts using jtharness Observer callbacks. We already use synchonzied keyword in Observer callbacks[1] as the TestRunner spawns multiple threads if we specify concurrency > 1. I have used Intellij Idea to find all inheritors of BasicObserver and added synchronization.

Maybe the better way would be to synchronize in jtharness itself to avoid doing it in the client code?
Hmm, this is probably impossible unless we want to make a breaking change and remove notifier field from Script class.

[1]

public synchronized void startingTest(TestResult tr) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants