You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2020/08/28 12:03:34 UTC

[wicket] branch master updated: WICKET-6822 AsynchronousPageStore Potential Memory Leak

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new e937c6e  WICKET-6822 AsynchronousPageStore Potential Memory Leak
e937c6e is described below

commit e937c6e78bc2261d4b5a6cabc845462ea6821efc
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Fri Aug 28 15:01:41 2020 +0300

    WICKET-6822 AsynchronousPageStore Potential Memory Leak
---
 .../wicket/pageStore/AsynchronousPageStore.java    | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java
index cc29efd..18838e8 100644
--- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java
+++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java
@@ -30,6 +30,7 @@ import org.apache.wicket.MetaDataKey;
 import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.page.IManageablePage;
 import org.apache.wicket.util.lang.Args;
+import org.apache.wicket.util.lang.Classes;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -160,7 +161,7 @@ public class AsynchronousPageStore extends DelegatingPageStore
 		@Override
 		public String toString()
 		{
-			return "PendingAdd [sessionId=" + sessionId + ", pageId=" + page.getPageId() + "]";
+			return "PendingAdd [sessionId=" + sessionId + ", pageId=" + page.getPageId() + ", pageClass=" + Classes.name(page.getClass()) + "]";
 		}
 
 		/**
@@ -278,15 +279,26 @@ public class AsynchronousPageStore extends DelegatingPageStore
 				}
 				catch (InterruptedException e)
 				{
+					log.debug("PageAddingRunnable:: Interrupted...");
 					Thread.currentThread().interrupt();
 				}
 
 				if (add != null)
 				{
-					log.debug("Saving asynchronously: {}...", add);
-					add.asynchronous = true;					
-					delegate.addPage(add, add.page);
-					map.remove(add.getKey());
+					try
+					{
+						log.debug("Saving asynchronously: {}...", add);
+						add.asynchronous = true;
+						delegate.addPage(add, add.page);
+					}
+					catch (Exception x)
+					{
+						log.error("An error occurred while saving asynchronously '{}'", add, x);
+					}
+					finally
+					{
+						map.remove(add.getKey());
+					}
 				}
 			}
 		}