You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Haster (Jira)" <ji...@apache.org> on 2020/08/05 20:21:00 UTC

[jira] [Commented] (WICKET-6810) Asynchronous+encrypted pagestore leads to WicketRuntimeException

    [ https://issues.apache.org/jira/browse/WICKET-6810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17171736#comment-17171736 ] 

Sven Haster commented on WICKET-6810:
-------------------------------------

The problem is the AsyncronousPageContext, on its page-adding-thread, delegates the getSessionData call to the original IPageContext, which is most likely a DefaultPageContext, which then tries to get the Session (via Session.get())from the current (page-adding-)thread. 
This thread of course has no Session but it tries to instantiate one via the Application (Application.get()), which then throws the error because this (page-adding-)thread also doesn't have an Application bound.

> Asynchronous+encrypted pagestore leads to WicketRuntimeException
> ----------------------------------------------------------------
>
>                 Key: WICKET-6810
>                 URL: https://issues.apache.org/jira/browse/WICKET-6810
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 9.0.0
>            Reporter: Sven Haster
>            Priority: Major
>
> If you have a Wicket application with the default DefaultPageManagerProvider (which sets a chain of PageStores) and with the storesettings "encrypted" and "asynchronous" on true (so your chain contains the AsynchronousPageStore and the CryptingPageStore), you get a WicketRuntimeException on the asynchronous pagestore thread upon the first page load.
>  
> This is because the asynchronous thread has no session, which the CryptingPageStore requires, leading to an exception (stacktrace below).
> A working test is somewhat difficult to achieve without mocking _everything_ to simulate this behaviour (because the default mocked wicket stuff such as MockPageContext avoid this bug) but it should be enough to just add 
> {code:java}
> getStoreSettings().setAsynchronous(true).setEncrypted(true);
> {code}
> to the init of a default wicket application that has the DefaultPageManagerProvider.
> This might not be easy to solve and therefore an unsupported configuration but given that you can create it by simply setting two properties to true, without any indication that it is wrong, it seems like a configuration bug at the least.
>  
> Stacktrace:
> {noformat}
> 2020-08-05 21:02:39,303 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) Exception in thread "Wicket-AsyncPageStore-PageSavingThread" org.apache.wicket.WicketRuntimeException: There is no application attached to current thread Wicket-AsyncPageStore-PageSavingThread
> 2020-08-05 21:02:39,303 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.Application.get(Application.java:213)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.Session.get(Session.java:181)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.pageStore.DefaultPageContext.getSessionData(DefaultPageContext.java:74)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.pageStore.AsynchronousPageStore$PendingAdd.getSessionData(AsynchronousPageStore.java:214)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.pageStore.CryptingPageStore.getSessionData(CryptingPageStore.java:90)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.pageStore.CryptingPageStore.addPage(CryptingPageStore.java:135)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.pageStore.SerializingPageStore.addPage(SerializingPageStore.java:82)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at deployment.keyhub-web-console.war//org.apache.wicket.pageStore.AsynchronousPageStore$PageAddingRunnable.run(AsynchronousPageStore.java:278)
> 2020-08-05 21:02:39,304 ERROR [stderr] (Wicket-AsyncPageStore-PageSavingThread) 	at java.base/java.lang.Thread.run(Thread.java:832)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)