Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tester] Start synchronization mechanism #5022

Closed
kriegfrj opened this issue Jan 1, 2022 · 7 comments
Closed

[tester] Start synchronization mechanism #5022

kriegfrj opened this issue Jan 1, 2022 · 7 comments
Assignees

Comments

@kriegfrj
Copy link
Contributor

kriegfrj commented Jan 1, 2022

Executive Summary

The tester needs a mechanism to disable automatic starting of the tester loop and have it run under programmatic control.

Detail

While playing with the various attempts to move to a more DS-oriented implementation of Bndtools (#5004), I think I have managed to robustly solve many of the startup issues that caused race conditions during testing.

However, there is one that is proving intractable. Fundamentally, the problem is as follows:

  • The Eclipse Workbench must start on the main thread.
  • Consequently, the Eclipse Workbench does not start until the launcher launches the main runnable.
  • Because the Workbench must run on the main thread, the tester cannot. Hence, the tester runs in a mode where it spawns its own thread. This thread is spawned and started as soon as the tester bundle is activated.
  • The main runnable is never launched until after the launcher has activated all of the bundles (including the tester).

The nett result of all this is that there is always a window where the tester bundle will start trying to run before the launcher has launched the Eclipse workbench. This window can be minimised (by giving the tester bundle the highest startlevel and making it start last), but it cannot be completely eliminated, and there is no mechanism in the tester to synchronize its start with any external process.

The problem is that the tester, as part of its ordinary operation, will attempt to load and execute the test cases. The process of loading the classes (and triggering lazy activation) often sets off a chain of dependencies that ultimately depends on the presence of a running workbench. Because of the small window above, this can sometimes lead to failures.

For the quickfix tests, we seem to have struck upon a combination that works most of the time, but it seems delicately balanced, and I think we still get the odd failure here and there. But it really made it clear just how delicately balanced it is when I started working on #5004 and re-introduced a whole new set of startup timing issues again that required delicate re-balancing.

Possibly, implementing #4587 would provide such a mechanism for my particular use case (add a global beforeAllBundles callback which blocks until the workbench is running). But that would still only happen after the tester bundle had done its discovery. I there might also be a case for allowing a manual/programmatic start mechanism for the tester so that even the discovery can be delayed until the time that is convenient for the system-under-test.

@bjhargrave
Copy link
Member

Sounds reasonable.

@github-actions
Copy link

github-actions bot commented Jan 7, 2023

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

@github-actions github-actions bot added the stale Stale issue or pull request label Jan 7, 2023
@github-actions
Copy link

This issue has been automatically closed due to inactivity. If you can reproduce this on a recent version of Bnd/Bndtools or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2023
@kriegfrj kriegfrj reopened this Nov 5, 2023
@kriegfrj
Copy link
Contributor Author

kriegfrj commented Nov 5, 2023

I think I need this one to get the CI tests working properly.

@github-actions github-actions bot removed the stale Stale issue or pull request label Nov 6, 2023
@pkriens
Copy link
Member

pkriens commented Feb 13, 2024

@kriegfrj could you move this to the 7.1 project and close this?

@kriegfrj
Copy link
Contributor Author

I'm happy to do it if I can figure out how?

@pkriens
Copy link
Member

pkriens commented Feb 16, 2024

Moved to project https:/orgs/bndtools/projects/1

@pkriens pkriens closed this as completed Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

No branches or pull requests

3 participants