i1083 f5 in wti fails with remote server#1199
Conversation
…thub.com/clevengr/pc2v9.git into i1083_F5_in_WTI_fails_with_remote_server
page saving is not needed due to the restructuring with APP_INITIALIZER -- AppInit automatically uses the browser's most-recent page URL.
add support for better handling of Run/Clar popup notifications.
added better support for saving/loading options in sessionStorage.
kkarakas
left a comment
There was a problem hiding this comment.
For this I ran the develop branch to see if I can observe the bug. I managed to observe the bug. However when I ran this branch, when I refresh I get a blank screen. I don't know why I will further test this.
johnbrvc
left a comment
There was a problem hiding this comment.
I will not pretend to completely understand how the Angular stuff works. I did look over the code, and for the most part, I don't really follow what is going on in the typescript. That being said, I did not see any glaring things that bothered me. I did notice a CI that was not mentioned in the PR (unless I missed it), and that's an exception handler was added for a parseInt in the ContestController; Handling error cases is almost always a good thing.
I did to a FULL test as per the PR, including all the regression tests (3 times). 1) test normal operations, 2) press F5 and repeat the tests, periodically pressing F5 3) restart, and essentially do the part 2 tests (pressing F5 during regression testing). I can confirm it works as described; I did not notice any anomalies.
Approved.
Well, the PR description does include the statement However, I will grant that the specific CI you mentioned (adding an exception handler) was not explicitly mentioned in the description. I've added it, mostly for posterity's sake... although it's not really a "CI" in that previously the code assumed that the value was an int (so parseInt couldn't fail; now, it might not be an int so I added the exception handler to cover the possibility. In other words, it's actually an important part of the code changes. So maybe I should have mentioned it separately... |
@kkarakas : Another reason (perhaps more likely) is that your browser is reusing cached values instead of hard-refreshing when you hit F5. To avoid this, try using a browser running it "Incognito" mode (or "InPrivate" mode, or whatever term your particular browser uses). (In Chrome you would run "Incognito Mode".) |
|
Using incognito solved the issue. I thought cmd + shift + R (hard refresh) would be sufficient alas it wasn't. When I looked in the console it appears that the websocket url is stuck in the old local IP address. I am not sure if it counts as a bug. Anyways I was able to run and observe that this branch fixed the bug. |
There was a problem hiding this comment.
Code looks good to me. The bug seems to be solved. Although I once ran into an error when I was testing with multiple logins but was not able to replicate. Because of the bug I was not able to login anymore until I restarted WTI. Do you know why this might happen?

Also realized that when the contest is stopped submit a clarification button is enabled but if you send a clarification you receive an error. Is that intentional? I imagine these are not related to this PR so If you want I can create an issue.
The "ContestClock" errors are likely the result of JS running (IE TS) and the client has logged out. It is trying to query the PC2 server for the time left in the contest, and if no one is logged in, that will, of course fail. It's probably not a problem per se'. It sounds to me like you were logging out and logging in to different account? It could be this happens because of the switching. @clevengr can probably shed more light on it. |

Description of what the PR does
Fixes the problem identified in Issue #1083 where pressing F5 in the WTI causes the contest clocks to freeze. Specifically:
app-init.service.tsinapp>modules>core services. This file contains a newAppInitServiceclass which handles all initialization for the SPA.app.module.tsso that it invokesAppInitService.initializeApp()at Angular bootstrap time. This ensures that all SPA initializations occur prior to display of any SPA components. (This matches what, according at least to ChatGPT, is Angular "best practice" for SPA initialization since Angular 14.)ContestService.updateLocalContestClockFromServer()to AppInitService. (It is this addition which actually fixes the bug described in F5 in WTI fails with remote server #1083 .session-storage.utilsservice in `app>modules>core>services. While not strictly necessary, this code refactor is included as part of "Continuous Improvement" (CI).app-header.componentto handle clock updates more efficiently.Issue which the PR addresses
Fixes #1083.
Environment in which the PR was developed:
Windows 11, Eclipse Version: 2021-12 (4.22.0), Java 1.8.0_381.
Precise steps for testing the PR:
NOTE: it is important to test this PR under the condition that the WTI Server is NOT running on the same machine as the web browser used to login to the WTI; or, alternatively, that the WTI Server listens on a different port than the default port (8080). Failure to observe these test conditions will invalidate the test (because the failure which this PR fixes -- as identified in Issue #1083 -- only occurs when the connection to the WTI server is NOT via the default http://localhost:8080.)
Setup
sumithello). Be sure the contest you use does not start automatically (sumithello does not).sumithello, logging in as judge3 or judge4 will work.)cdinto the resulting folder.pc2v9.inifile does not contain an entrywtiboardUseDivisions=true(either set it to false, delete it entirely, or else assign a Division to every team in the contest sincesumithellodoes not do this by default)../bin/pc2wti).http://<ip>:<port>where<ip>is the address of the other machine -- the one running the WTI Server -- and<port>is the port on which the WTI Server is listening (the default port, configured in thepc2v9.inifile in the WTI project folder, is 8080)). If you have used this browser to connect to WTI previously, be sure to clear the browser's cache (or, use Incognito mode).wtiport=8080entry in the WTI Server's startup folder to specify a different port. This change must be done before starting the WTI Server.Test correct Pre-Contest operations
sumithello, "team1" through "team10" with joe passwords will work.)Test for Regressions in normal operations
Configure Contest > Timestab, clickStart All.Runs).Scoreboardtab on the WTI, then verify that the displayed scoreboard matches whatever submissions you have made (this is why you should submit at least one "Yes" run as noted above...)Test Correct Operation after F5.