Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-5707

avoid invoking an event listener after a session expired

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 10.1.0
    • 9.6.5
    • None
    • Security Level: Jimmy

      Steps to Reproduce

      1. click the button
        it simulates session logout/timeout from a different thread (browser tab/background process)

      Current Result

      2024-05-10 12:49:17 [WARN ] AbstractComponent:3125 - Page [Page g0pO_] was destroyed because desktop was destroyed.
      It is usually caused by invalidating the native session directly. If it is required, please set Attributes.RENEW_NATIVE_SESSION first.
      >> handle onDummy

      Expected Result

      • don't print the warning log
      • don't invoke the event listener since the session expired and its desktop should be invalid, so running the event listener has no meaning

      Debug Information

      • in the customer environment, this caused 240,000 log entries within 2 minutes producing ~100MB of log files, and CPU spikes during that time.
      • in a real case, a system shuts down and enforce to invalidate all user sessions but because of handling events and writing logs, the system cannot shut down immediately.. Most of these events were PropertyChangeEvents or internal onBindInit/onBindClear events
      • another case, a user might be reported as an illegal user, the admin needs to enforce to invalidate his session, but ZK will still process the session's events.

      Root Cause

      AbstractComponent.service()

      	/*package*/ void service(Event event, Scope scope, final List<EventListenerInfo> listeners,
      			final EventHandler evthd, final Method mtd, boolean skipPageListener) throws Exception {
      		final Execution exec = Executions.getCurrent();
      		final Desktop desktop = exec.getDesktop();
      		final Page page = _page != null ? _page : desktop.getFirstPage();
      		if (page == null || !page.isAlive()) {
      			String msg = (page == null ? "No page is available in " + desktop : "Page " + page + " was destroyed");
      			if (desktop.isAlive())
      				msg += " (but desktop is alive)";
      			else
      				msg += " because desktop was destroyed.\n"
      						+ "It is usually caused by invalidating the native session directly. "
      						+ "If it is required, please set Attributes.RENEW_NATIVE_SESSION first.";
      			log.warn(msg);
      		}
      

      Workaround

      DeadDesktopIntercepter.java

            jumperchen jumperchen
            hawk hawk
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: