Wicket
  1. Wicket
  2. WICKET-3876

Improve synchronization in AsynchronousDataStore buffer structure

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5-RC5.1
    • Fix Version/s: 1.5-RC6
    • Component/s: wicket
    • Labels:
      None

      Description

      On heavy load we saw the following exception in the logs:

      java.lang.NullPointerException
      org.apache.wicket.pageStore.AsynchronousDataStore.removeData(AsynchronousDataStore.java:192)
      org.apache.wicket.pageStore.DefaultPageStore.removePageData(DefaultPageStore.java:104)
      org.apache.wicket.pageStore.DefaultPageStore.unbind(DefaultPageStore.java:149)
      org.apache.wicket.page.PageStoreManager.sessionExpired(PageStoreManager.java:407)
      org.apache.wicket.Application.sessionUnbound(Application.java:474)
      org.apache.wicket.protocol.http.WebApplication.sessionUnbound(WebApplication.java:456)
      org.apache.wicket.session.HttpSessionStore$SessionBindingListener.valueUnbound(HttpSessionStore.java:415)
      org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1788)
      org.apache.catalina.session.StandardSession.expire(StandardSession.java:866)
      org.apache.catalina.session.StandardSession.expire(StandardSession.java:740)
      org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1253)
      org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:186)
      org.apache.wicket.session.HttpSessionStore.invalidate(HttpSessionStore.java:177)
      org.apache.wicket.Session.destroy(Session.java:492)
      org.apache.wicket.Session.invalidateNow(Session.java:504)
      org.apache.wicket.Session.detach(Session.java:645)
      org.apache.wicket.request.cycle.RequestCycle.onDetach(RequestCycle.java:543)
      org.apache.wicket.request.cycle.RequestCycle.detach(RequestCycle.java:477)
      org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:255)
      org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:160)
      org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:216)
      ....

      The buffer structure "entries" may be emptied by one worker thread and tried to be emptied in another...

      1. AsyncDataStore.java
        8 kB
        Andrea Del Bene

        Activity

        Hide
        Martin Grigorov added a comment -

        The previous impl is replaced with Andrea's impl with r1145561.

        Show
        Martin Grigorov added a comment - The previous impl is replaced with Andrea's impl with r1145561.
        Hide
        Martin Grigorov added a comment -

        The code looks OK.
        I'll try it locally and if it is stable then I'll use it in our performance tests.

        Show
        Martin Grigorov added a comment - The code looks OK. I'll try it locally and if it is stable then I'll use it in our performance tests.
        Hide
        Andrea Del Bene added a comment -

        The line of code which throws the exception (AsynchronousDataStore.java:192) is relative to snapshot code o is exactly from RC5.1 version?

        Anyway, I've implemented a version AsynchronousDataStore which makes extensive use of java.util.concurrent.ThreadPoolExecutor class to coordinate saving thread and queue. Using ThreadPoolExecutor you can delegate it synchronization's issues (it's a Java 5 class).
        The code is much more simple and I've successfully tested id with DiskDataStoreTest. I've called it AsyncDataStore in order to easily switch between the current AsynchronousDataStore and my new class.

        Can you give my class a chance ?

        Show
        Andrea Del Bene added a comment - The line of code which throws the exception (AsynchronousDataStore.java:192) is relative to snapshot code o is exactly from RC5.1 version? Anyway, I've implemented a version AsynchronousDataStore which makes extensive use of java.util.concurrent.ThreadPoolExecutor class to coordinate saving thread and queue. Using ThreadPoolExecutor you can delegate it synchronization's issues (it's a Java 5 class). The code is much more simple and I've successfully tested id with DiskDataStoreTest. I've called it AsyncDataStore in order to easily switch between the current AsynchronousDataStore and my new class. Can you give my class a chance ?

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Martin Grigorov
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development