Hi Bas,

that sounds like a bug.

Your quickstart didn't make it through the mailing list, would you please 
attach it to a new Jira issue?

Thanks
Sven

Am 23. Juli 2021 19:30:46 MESZ schrieb Bas Gooren <b...@iswd.nl>:
>Hi all,
>
>Today I spent the better part of my day investigating a bug report
>regarding a hibernate LazyInitializationException.
>Since we use detaching models everywhere and (in general) never see
>such
>issues anymore, this one was interesting :-)
>
>After much debugging I found out what is happening.
>
>We have a page which has a database model + links for prev/next item
>(in
>the database).
>When the users double-clicks on one of the links, the first click is
>OK,
>and the second click throws a StalePageException during request cycle
>processing.
>
>So far, normal.
>
>However, stepping through the wicket code, this is what happens:
>
>1) Resolve to ListenerRequestHandler, execute it, throws
>StalePageException
>2) exception mapper handles this and we execute a
>RenderPageRequestHandler,
>which re-renders the page
>3) the request cycle detaches, which delegates in part
>to RequestHandlerExecutor.detach()
>4) The handlers to detach are both handlers from step 1 and 2; During
>the
>detach of ListenerRequestHandler, it initializes ListenerLogData, which
>(in
>the PageLogData ctor) throws the StalePageException again!
>5) The second handler (RenderPageRequestHandler) is not detached, thus
>all
>models in the page are not detached
>6) The user clicks on a link and boom, the models are all still
>attached
>and there we get the LazyInitializationException
>
>I think that (a) RequestHandlerExecutor.detach() should ensure all
>handlers
>are detached, and (b) that failing to collect LogData should not stop
>the
>detaching of a request handler.
>
>What do you think?
>
>I tried to make the simplest possible Quickstart to demonstrate this.
>
>Weird stuff: on the homepage of the quick start, the page is properly
>detached when a stale link is clicked;
>On another (test) page, the page is not properly detached.
>
>Steps to reproduce:
>
>Run Quickstart
>Click on “Test” link on homepage
>Observe that the following is logged:
>
>Model still attached? false
>Page detaching
>
>Now click on "Click me (stale link)!”
>Now refresh the page (re-render)
>
>Observe that the following is logged:
>
>Model still attached? true
>Page detaching
>
>—> So the page was not detached
>
>These steps don’t have the same result on the homepage. So my guess is
>there is some relation to the fact that we are interacting with a
>stateful,
>non-mounted page.
>
>Met vriendelijke groet,
>Kind regards,
>
>Bas Gooren

Reply via email to