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

multiple GUI/clients running: give warning #6577

Closed
FreddieAkeroyd opened this issue Jun 5, 2021 · 6 comments
Closed

multiple GUI/clients running: give warning #6577

FreddieAkeroyd opened this issue Jun 5, 2021 · 6 comments

Comments

@FreddieAkeroyd
Copy link
Member

As a user i would like to be warned if i accidentally start a second instance of the ibex GUI - this is similar to #5084

Acceptance criteria

  • if a second GUI is started, a warning dialogue notifies the user and asks if they wish to continue
  • (optional) if it is easy/possible. one of the options could be "switch to existing gui"
@FreddieAkeroyd
Copy link
Member Author

Look at process list to see if second instance

@Adam-Szw
Copy link
Contributor

Adam-Szw commented Aug 18, 2021

Code PR: ISISComputingGroup/ibex_gui#1344
Release notes PR: #6731
Wiki page added: https://github.com/ISISComputingGroup/ibex_developers_manual/wiki/Local-files-and-start-up

Unfortunately optional goal would seem to require adding more dependencies since switching between windows/tabs is more of a system thing than something easily controllable from Java app.

The solution required programming in creation of a folder and temporary files in user directory (this directory could be easily changed to anywhere else) so I added a wiki entry with some more explanation.

To test this when reviewing:

  • Either run client standalone or run from Eclipse (it shouldn't matter)
  • In eclipse Run -> Run Configurations ->Launch Group -> add ibex.product a couple of times
  • Now try closing app gracefully, crashing it or forcing it to close with task manager. it should still work

Since this process seems difficult to automate, I propose that a manual test is added for this if it passes review.

Note when using Eclipse to test this: There exists an edge case that when starting many clients exacly at the same time it is possible for multiple to open without a prompt. This is because GUI needs a moment to start-up and also because a file I/O operation takes a moment to create a new file and in that time there is not yet a file to check for in the second instance. Realistically this would not be a problem if someone tries to open another client just a fraction of a second later since the file writing happens very early at the startup of the client.

@Adam-Szw
Copy link
Contributor

Also note: We might discover that some tests which have 2 clients running at the same time don't work anymore since prompt has to be accepted first.

@JamesKingWork
Copy link
Contributor

Code works correctly but I have requested a few improvements, documentation looks good. Please do add to the system tests and I'll review that too in the rereview

@Adam-Szw
Copy link
Contributor

While I was reworking this I tried a different method of testing and discovered that this actually doesn't work reliably so I will be re-doing it with a different method to make it more robust.
File locking only works if locking happens:

  • in two threads of same program
  • if two programs are running on same JVM (which is the case when using eclipse testing method from before hence it was not discovered before)
    This is not very well documented.

To reproduce:

  • Create a second workspace of ibex gui and go through all setup steps again
  • Run the ibex from two different eclipse instances
  • It's not working 👎

@Adam-Szw
Copy link
Contributor

Adam-Szw commented Aug 23, 2021

Solved with different (more robust) approach
Wiki page updated https://github.com/ISISComputingGroup/ibex_developers_manual/wiki/Local-files-and-start-up
To test this properly using Eclipse see comment above. Edge cases should also be much better covered.

Manual system test added https://github.com/ISISComputingGroup/ibex_developers_manual/wiki/Manual-System-Tests (Section 3, Test 2)
Tests that mentioned opening multiple clients updated to accept prompt

Ticket opened to automate that in the future #6737

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

No branches or pull requests

4 participants