You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thorsten Schöning <ts...@am-soft.de> on 2016/03/11 19:45:46 UTC

Enclosure can't find its markup anymore after restart of Tomcat

Hi all,

I'm using some wicket:enclosures in the navigation of my web app to
hide some content surrounding links, if the links are invisible for
some reason. This worked well with Wicket 6.0.x, but now I get the
following problem:

Consider a fresh, clean, empty Tomcat server, no wicket persistent
data whatsoever, no session, no DiskDataStore, nothing. If I now
start my app I can use it without any problems, click links, reload
pages, some enclosures are hidden, some are visible, all depending on
the visibility of the containing links, everything like I need it.

The only thing I'm doing now is restarting the Tomcat server and on
refreshing the current page in the browser I get a stackoverflow in
Enclosure while trying to determine its visibility. It tries to find
its markup, can't, which somehow leads back to where the caller came
from in AbstractMarkupSourcingStrategy#searchMarkupInTransparentResolvers
and which once again tries to find the markup with the same Enclosure
already tried before... The stackoverflow happens in my web app with
more complex HTML, but in a reduced version based on a quickstart I
don't get one, but instead the following exception is thrown:

> java.lang.IllegalArgumentException: Argument 'markup' may not be null.

So I guess the root cause is the same in both cases, Enclosure can't
find it's markup anymore.

Sadly I couldn't reproduce this with Jetty and an original quickstart,
because I don't know how to restart Jetty the same way I do with
Tomcat. If it gets stopped and started again, it generates a new
random temp working dir and starts without persistent data as well, so
the problem doesn't occur. Tomcat instead keeps some session data and
such during restarts and I guess that's part of the problem. Whenever
I clean the working dir of Tomcat, the problem is gone again until I a
restart is issued without cleaning the working dir.

I tried to track this down and recognized one important difference:

On the first empty start of Tomcat without any persistent data, the
ids recognized in EnclosureHandler for the tags are different than
after a restart of Tomcat. The numeric part of the tag ids is
incremented whenever a new tag is recognized and on the first clean
start this numeric part is simply higher, e.g. 20, than after a
restart, in which case it might be 15. This indicates that after the
restart less tags are parsed from the underlying markup compared to
the first start of the web app. Because of the wicket page cache and
such, the Enclosures with the OLD ids are still assigned to pages
after a restart, so if a subsequent process of the markup produces
different ids now, Wicket seems unable to find the OLD enclosure
ids in the markup, because the MarkupStream now contains Enclosures
with NEW ids. I could verify that in the debugger: Wicket tries to
determine visibility for Enclosure with id 20, because that was stores
in the page cache, and after a restart the logical same markup
component now has the id e.g. 15 and therefore can't be found anymore.

I think this has to do something with my HTML structure:

I have a main div as a WebMarkupContainer, which contains two Panels
on the same level, which both contains links. Only second Panel
contains the links embedded into enclosures. My feeling is that after
a restart the links of the first Panel are not parsed anymore from
their markup, because the objects where in the store already, so when
the markup for the enclosures in the second panel are parsed, the
request unique id is simply less than it was after the first clean
start without any persistent data.

I have two questions now:

1. Workaround?

I think if I'm able to get Wicket to not store any pages anymore
persistently, I could workaround the problem. I don't care if people
need to login or whatever in the worst case, but the app needs to be
functional after a restart of Tomcat without manually cleaning working
directories and such.

I already tried with a custom DefaultPageManagerProvider and
IDataStore implementation which simply doesn't store and retrieve any
data. But this is not enough, the problem still occurs.

2. Root cause?

In the end of course I need to find the root cause and would like to
fix that. How should Wicket behave in parsing markup when pages come
from the cache? Does it only parse some missing pieces of markup like
for Enclosure, because t doesn't cache it's associated markup/child
component or always everything like from a clean start? I guess the
first, but that would mean that ids always change and relying on them
during subsequent requests is not save.

Thanks for any hints!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Enclosure can't find its markup anymore after restart of Tomcat

Posted by Martin Grigorov <mg...@apache.org>.
Sounds like https://issues.apache.org/jira/browse/WICKET-6109
Please try with latest 7.3.0-SNAPSHOT if you are able.
Thanks!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Mar 11, 2016 at 7:57 PM, Thorsten Schöning <ts...@am-soft.de>
wrote:

> Guten Tag Thorsten Schöning,
> am Freitag, 11. März 2016 um 19:45 schrieben Sie:
>
> > I tried to track this down and recognized one important difference:
>
> The following are parts of the stacktrace after a clean startup with
> a breakpoint in EnclosureHandler, where the tag has the following id
> and content:
>
> > wicket_enclosure34: <wicket:enclosure child="home.cmds.blackOrWhitelist">
>
> > Daemon Thread [http-bio-127.0.0.1-8081-exec-5] (Suspended (breakpoint at
> line 131 in EnclosureHandler))
> >         owns: SocketWrapper<E>  (id=89)
> >         EnclosureHandler.onComponentTag(ComponentTag) line: 131
> >         EnclosureHandler(AbstractMarkupFilter).nextElement() line: 100
> >         InlineEnclosureHandler(AbstractMarkupFilter).nextElement() line:
> 95
> >         ConditionalCommentFilter(AbstractMarkupFilter).nextElement()
> line: 95
> >         WicketContainerTagHandler(AbstractMarkupFilter).nextElement()
> line: 95
> >         RelativePathPrefixHandler(AbstractMarkupFilter).nextElement()
> line: 95
> >         StyleAndScriptIdentifier(AbstractMarkupFilter).nextElement()
> line: 95
> >         MarkupFactory$1(AbstractMarkupParser).getNextTag() line: 217
> >         MarkupFactory$1(AbstractMarkupParser).parseMarkup() line: 232
> >         MarkupFactory$1(AbstractMarkupParser).parse() line: 185
> >         SimpleMarkupLoader.loadMarkup(MarkupContainer,
> MarkupResourceStream, IMarkupLoader, boolean) line: 51
> >         InheritedMarkupMarkupLoader.loadMarkup(MarkupContainer,
> MarkupResourceStream, IMarkupLoader, boolean) line: 57
> >         DefaultMarkupLoader.loadMarkup(MarkupContainer,
> MarkupResourceStream, IMarkupLoader, boolean) line: 52
> >         MarkupFactory.loadMarkup(MarkupContainer, MarkupResourceStream,
> boolean) line: 412
> >         MarkupCache.loadMarkup(MarkupContainer, MarkupResourceStream,
> boolean) line: 447
> >         MarkupCache.loadMarkupAndWatchForChanges(MarkupContainer,
> MarkupResourceStream, boolean) line: 543
> >         MarkupCache.getMarkup(MarkupContainer, Class<?>, boolean) line:
> 304
> >         MarkupFactory.getMarkup(MarkupContainer, Class<?>, boolean)
> line: 236
> >         MarkupFactory.getMarkup(MarkupContainer, boolean) line: 194
> >         PnNav(MarkupContainer).getAssociatedMarkup() line: 456
> >         PnNav(MarkupContainer).getRegionMarkup() line: 2224
> >         PnNav(Panel).getRegionMarkup() line: 96
> >         PnNav(MarkupContainer).newDequeueContext() line: 2211
> >         PnNav(MarkupContainer).dequeue() line: 2029
> >         WebMarkupContainer(MarkupContainer).addedComponent(Component)
> line: 1049
> >         WebMarkupContainer(MarkupContainer).add(Component...) line: 239
> >         HomePage.<init>(PageParameters) line: 25
> >         NativeConstructorAccessorImpl.newInstance0(Constructor,
> Object[]) line: not available [native method]
> >         NativeConstructorAccessorImpl.newInstance(Object[]) line: 57
> >         DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 45
> >         Constructor<T>.newInstance(Object...) line: 526
> >         DefaultPageFactory.newPage(Constructor<C>, PageParameters) line:
> 171
> >         DefaultPageFactory.newPage(Class<C>) line: 76
> >         DefaultMapperContext.newPageInstance(Class<IRequestablePage>,
> PageParameters) line: 102
> >         PageProvider.resolvePageInstance(Integer,
> Class<IRequestablePage>, PageParameters, Integer) line: 271
> >         PageProvider.getPageInstance() line: 169
> >         WebPageRenderer(PageRenderer).getPage() line: 78
> >         WebPageRenderer.isPageStateless() line: 287
> >         WebPageRenderer.shouldRenderPageAndWriteResponse(RequestCycle,
> Url, Url) line: 329
> >         WebPageRenderer.respond(RequestCycle) line: 193
> >         RenderPageRequestHandler.respond(IRequestCycle) line: 175
>
> The following is the same stacktrace after a restart of Tomcat and as
> you can see, the id of the tag in EnclosureHandler is different now
> and markup is only parsed because the Enclosure instance from the page
> cache with the old id needs its child component and tries to find it
> in the markup:
>
> > wicket_enclosure12: <wicket:enclosure child="home.cmds.blackOrWhitelist">
>
> > Daemon Thread [http-bio-127.0.0.1-8081-exec-3] (Suspended (breakpoint at
> line 131 in EnclosureHandler))
> >         owns: SocketWrapper<E>  (id=84)
> >         EnclosureHandler.onComponentTag(ComponentTag) line: 131
> >         EnclosureHandler(AbstractMarkupFilter).nextElement() line: 100
> >         InlineEnclosureHandler(AbstractMarkupFilter).nextElement() line:
> 95
> >         ConditionalCommentFilter(AbstractMarkupFilter).nextElement()
> line: 95
> >         WicketContainerTagHandler(AbstractMarkupFilter).nextElement()
> line: 95
> >         RelativePathPrefixHandler(AbstractMarkupFilter).nextElement()
> line: 95
> >         StyleAndScriptIdentifier(AbstractMarkupFilter).nextElement()
> line: 95
> >         MarkupFactory$1(AbstractMarkupParser).getNextTag() line: 217
> >         MarkupFactory$1(AbstractMarkupParser).parseMarkup() line: 232
> >         MarkupFactory$1(AbstractMarkupParser).parse() line: 185
> >         SimpleMarkupLoader.loadMarkup(MarkupContainer,
> MarkupResourceStream, IMarkupLoader, boolean) line: 51
> >         InheritedMarkupMarkupLoader.loadMarkup(MarkupContainer,
> MarkupResourceStream, IMarkupLoader, boolean) line: 57
> >         DefaultMarkupLoader.loadMarkup(MarkupContainer,
> MarkupResourceStream, IMarkupLoader, boolean) line: 52
> >         MarkupFactory.loadMarkup(MarkupContainer, MarkupResourceStream,
> boolean) line: 412
> >         MarkupCache.loadMarkup(MarkupContainer, MarkupResourceStream,
> boolean) line: 447
> >         MarkupCache.loadMarkupAndWatchForChanges(MarkupContainer,
> MarkupResourceStream, boolean) line: 543
> >         MarkupCache.getMarkup(MarkupContainer, Class<?>, boolean) line:
> 304
> >         MarkupFactory.getMarkup(MarkupContainer, Class<?>, boolean)
> line: 236
> >         MarkupFactory.getMarkup(MarkupContainer, boolean) line: 194
> >         PnNav(MarkupContainer).getAssociatedMarkup() line: 456
> >
>  PanelMarkupSourcingStrategy(AssociatedMarkupSourcingStrategy).getMarkup(MarkupContainer,
> Component) line: 95
> >         PnNav(MarkupContainer).getMarkup(Component) line: 502
> >         Enclosure(Component).getMarkup() line: 755
> >         Enclosure.getChild() line: 138
> >         Enclosure.onConfigure() line: 180
> >         Enclosure(Component).configure() line: 1055
> >         Enclosure(Component).internalBeforeRender() line: 940
> >         Enclosure(Component).beforeRender() line: 1017
> >         PnNav(MarkupContainer).onBeforeRenderChildren() line: 1866
> >         PnNav(Component).onBeforeRender() line: 3877
> >         PnNav(Component).internalBeforeRender() line: 949
> >         PnNav(Component).beforeRender() line: 1017
> >         WebMarkupContainer(MarkupContainer).onBeforeRenderChildren()
> line: 1866
> >         WebMarkupContainer(Component).onBeforeRender() line: 3877
> >         WebMarkupContainer(Component).internalBeforeRender() line: 949
> >         WebMarkupContainer(Component).beforeRender() line: 1017
> >         HomePage(MarkupContainer).onBeforeRenderChildren() line: 1866
> >         HomePage(Component).onBeforeRender() line: 3877
> >         HomePage(Page).onBeforeRender() line: 801
> >         HomePage(Component).internalBeforeRender() line: 949
> >         HomePage(Component).beforeRender() line: 1017
> >         HomePage(Component).internalPrepareForRender(boolean) line: 2215
> >         HomePage(Page).internalPrepareForRender(boolean) line: 242
> >         HomePage(Component).render() line: 2304
> >         HomePage(Page).renderPage() line: 1018
> >         WebPageRenderer.renderPage(Url, RequestCycle) line: 124
> >         WebPageRenderer.respond(RequestCycle) line: 195
> >         RenderPageRequestHandler.respond(IRequestCycle) line: 175
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
> AM-SoFT IT-Systeme      http://www.AM-SoFT.de/
>
> Telefon...........05151-  9468- 55
> Fax...............05151-  9468- 88
> Mobil..............0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Enclosure can't find its markup anymore after restart of Tomcat

Posted by Thorsten Schöning <ts...@am-soft.de>.
Guten Tag Thorsten Schöning,
am Freitag, 11. März 2016 um 19:45 schrieben Sie:

> I tried to track this down and recognized one important difference:

The following are parts of the stacktrace after a clean startup with
a breakpoint in EnclosureHandler, where the tag has the following id
and content:

> wicket_enclosure34: <wicket:enclosure child="home.cmds.blackOrWhitelist">

> Daemon Thread [http-bio-127.0.0.1-8081-exec-5] (Suspended (breakpoint at line 131 in EnclosureHandler))
>         owns: SocketWrapper<E>  (id=89)
>         EnclosureHandler.onComponentTag(ComponentTag) line: 131
>         EnclosureHandler(AbstractMarkupFilter).nextElement() line: 100
>         InlineEnclosureHandler(AbstractMarkupFilter).nextElement() line: 95
>         ConditionalCommentFilter(AbstractMarkupFilter).nextElement() line: 95
>         WicketContainerTagHandler(AbstractMarkupFilter).nextElement() line: 95
>         RelativePathPrefixHandler(AbstractMarkupFilter).nextElement() line: 95
>         StyleAndScriptIdentifier(AbstractMarkupFilter).nextElement() line: 95
>         MarkupFactory$1(AbstractMarkupParser).getNextTag() line: 217
>         MarkupFactory$1(AbstractMarkupParser).parseMarkup() line: 232
>         MarkupFactory$1(AbstractMarkupParser).parse() line: 185
>         SimpleMarkupLoader.loadMarkup(MarkupContainer, MarkupResourceStream, IMarkupLoader, boolean) line: 51
>         InheritedMarkupMarkupLoader.loadMarkup(MarkupContainer, MarkupResourceStream, IMarkupLoader, boolean) line: 57
>         DefaultMarkupLoader.loadMarkup(MarkupContainer, MarkupResourceStream, IMarkupLoader, boolean) line: 52
>         MarkupFactory.loadMarkup(MarkupContainer, MarkupResourceStream, boolean) line: 412
>         MarkupCache.loadMarkup(MarkupContainer, MarkupResourceStream, boolean) line: 447
>         MarkupCache.loadMarkupAndWatchForChanges(MarkupContainer, MarkupResourceStream, boolean) line: 543
>         MarkupCache.getMarkup(MarkupContainer, Class<?>, boolean) line: 304
>         MarkupFactory.getMarkup(MarkupContainer, Class<?>, boolean) line: 236
>         MarkupFactory.getMarkup(MarkupContainer, boolean) line: 194
>         PnNav(MarkupContainer).getAssociatedMarkup() line: 456
>         PnNav(MarkupContainer).getRegionMarkup() line: 2224
>         PnNav(Panel).getRegionMarkup() line: 96
>         PnNav(MarkupContainer).newDequeueContext() line: 2211
>         PnNav(MarkupContainer).dequeue() line: 2029
>         WebMarkupContainer(MarkupContainer).addedComponent(Component) line: 1049
>         WebMarkupContainer(MarkupContainer).add(Component...) line: 239
>         HomePage.<init>(PageParameters) line: 25
>         NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not available [native method]
>         NativeConstructorAccessorImpl.newInstance(Object[]) line: 57
>         DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 45
>         Constructor<T>.newInstance(Object...) line: 526
>         DefaultPageFactory.newPage(Constructor<C>, PageParameters) line: 171
>         DefaultPageFactory.newPage(Class<C>) line: 76
>         DefaultMapperContext.newPageInstance(Class<IRequestablePage>, PageParameters) line: 102
>         PageProvider.resolvePageInstance(Integer, Class<IRequestablePage>, PageParameters, Integer) line: 271
>         PageProvider.getPageInstance() line: 169
>         WebPageRenderer(PageRenderer).getPage() line: 78
>         WebPageRenderer.isPageStateless() line: 287
>         WebPageRenderer.shouldRenderPageAndWriteResponse(RequestCycle, Url, Url) line: 329
>         WebPageRenderer.respond(RequestCycle) line: 193
>         RenderPageRequestHandler.respond(IRequestCycle) line: 175

The following is the same stacktrace after a restart of Tomcat and as
you can see, the id of the tag in EnclosureHandler is different now
and markup is only parsed because the Enclosure instance from the page
cache with the old id needs its child component and tries to find it
in the markup:

> wicket_enclosure12: <wicket:enclosure child="home.cmds.blackOrWhitelist">

> Daemon Thread [http-bio-127.0.0.1-8081-exec-3] (Suspended (breakpoint at line 131 in EnclosureHandler))
>         owns: SocketWrapper<E>  (id=84)
>         EnclosureHandler.onComponentTag(ComponentTag) line: 131
>         EnclosureHandler(AbstractMarkupFilter).nextElement() line: 100
>         InlineEnclosureHandler(AbstractMarkupFilter).nextElement() line: 95
>         ConditionalCommentFilter(AbstractMarkupFilter).nextElement() line: 95
>         WicketContainerTagHandler(AbstractMarkupFilter).nextElement() line: 95
>         RelativePathPrefixHandler(AbstractMarkupFilter).nextElement() line: 95
>         StyleAndScriptIdentifier(AbstractMarkupFilter).nextElement() line: 95
>         MarkupFactory$1(AbstractMarkupParser).getNextTag() line: 217
>         MarkupFactory$1(AbstractMarkupParser).parseMarkup() line: 232
>         MarkupFactory$1(AbstractMarkupParser).parse() line: 185
>         SimpleMarkupLoader.loadMarkup(MarkupContainer, MarkupResourceStream, IMarkupLoader, boolean) line: 51
>         InheritedMarkupMarkupLoader.loadMarkup(MarkupContainer, MarkupResourceStream, IMarkupLoader, boolean) line: 57
>         DefaultMarkupLoader.loadMarkup(MarkupContainer, MarkupResourceStream, IMarkupLoader, boolean) line: 52
>         MarkupFactory.loadMarkup(MarkupContainer, MarkupResourceStream, boolean) line: 412
>         MarkupCache.loadMarkup(MarkupContainer, MarkupResourceStream, boolean) line: 447
>         MarkupCache.loadMarkupAndWatchForChanges(MarkupContainer, MarkupResourceStream, boolean) line: 543
>         MarkupCache.getMarkup(MarkupContainer, Class<?>, boolean) line: 304
>         MarkupFactory.getMarkup(MarkupContainer, Class<?>, boolean) line: 236
>         MarkupFactory.getMarkup(MarkupContainer, boolean) line: 194
>         PnNav(MarkupContainer).getAssociatedMarkup() line: 456
>         PanelMarkupSourcingStrategy(AssociatedMarkupSourcingStrategy).getMarkup(MarkupContainer, Component) line: 95
>         PnNav(MarkupContainer).getMarkup(Component) line: 502
>         Enclosure(Component).getMarkup() line: 755
>         Enclosure.getChild() line: 138
>         Enclosure.onConfigure() line: 180
>         Enclosure(Component).configure() line: 1055
>         Enclosure(Component).internalBeforeRender() line: 940
>         Enclosure(Component).beforeRender() line: 1017
>         PnNav(MarkupContainer).onBeforeRenderChildren() line: 1866
>         PnNav(Component).onBeforeRender() line: 3877
>         PnNav(Component).internalBeforeRender() line: 949
>         PnNav(Component).beforeRender() line: 1017
>         WebMarkupContainer(MarkupContainer).onBeforeRenderChildren() line: 1866
>         WebMarkupContainer(Component).onBeforeRender() line: 3877
>         WebMarkupContainer(Component).internalBeforeRender() line: 949
>         WebMarkupContainer(Component).beforeRender() line: 1017
>         HomePage(MarkupContainer).onBeforeRenderChildren() line: 1866
>         HomePage(Component).onBeforeRender() line: 3877
>         HomePage(Page).onBeforeRender() line: 801
>         HomePage(Component).internalBeforeRender() line: 949
>         HomePage(Component).beforeRender() line: 1017
>         HomePage(Component).internalPrepareForRender(boolean) line: 2215
>         HomePage(Page).internalPrepareForRender(boolean) line: 242
>         HomePage(Component).render() line: 2304
>         HomePage(Page).renderPage() line: 1018
>         WebPageRenderer.renderPage(Url, RequestCycle) line: 124
>         WebPageRenderer.respond(RequestCycle) line: 195
>         RenderPageRequestHandler.respond(IRequestCycle) line: 175

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning       E-Mail: Thorsten.Schoening@AM-SoFT.de
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org