reiern70 opened a new pull request, #1617:
URL: https://github.com/apache/wicket/pull/1617
storeAsynchronousContextClosed checks what an IPageStore may do with the
IPageContext it is handed once the add has moved to the page saving thread. It
queued the add, then called destroy() on the delegate store rather than on the
AsynchronousPageStore, so nothing ever interrupted or joined that thread. The
test read its failure reference and returned while the saving thread had
usually not started, and passed by never looking.
That left two problems. Assertion failures raised on the saving thread are
Errors, so PageAddingRunnable's catch of Exception does not hold them; they
escaped onto a daemon thread that outlived the test, writing into a store the
test had already destroyed. Reported at whatever point the runner noticed, this
is the intermittent failure seen in CI. And because the assertions were never
reached, a wrong expectation went unnoticed: the test required
getSessionAttribute("key2", () -> null) to throw asynchronously.
It does not, and should not. PendingAdd#getSessionAttribute throws only
where a value would be changed - a missing entry whose supplier yields a value.
A read of a missing key with a null default changes nothing and returns null,
which is what the getSessionData block in the same test already expects. The
attribute expectations now mirror it: a cached key reads back, a missing key
reads null, and only an attempted set throws. No production behaviour changes.
The test now counts down a latch in a finally around the asynchronous body
and awaits it, so an add that never happens fails the test instead of passing
it. The body records any Throwable for the test thread to rethrow, which lets
the sentinel "set a marker exception, then swallow the expected one" idiom give
way to assertThrows. destroy() is called on the AsynchronousPageStore,
interrupting and joining the saving thread, and still reaches the delegate
through DelegatingPageStore.
GitHub issue #1616: https://github.com/apache/wicket/issues/1616
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]