You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by de...@apache.org on 2016/10/06 13:57:22 UTC

[1/4] jena git commit: Add failing test for memory leak

Repository: jena
Updated Branches:
  refs/heads/master 95235b861 -> ec9573f2a


Add failing test for memory leak

ConsumerChoicePointFrame leaks from LPBRuleEngine through cached
Generator


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/1b49b035
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/1b49b035
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/1b49b035

Branch: refs/heads/master
Commit: 1b49b0359fb48aa926c9aa22d1b30426ce92c77d
Parents: fbb53ef
Author: J�r�mie Fraudeau <je...@laposte.net>
Authored: Thu Sep 29 23:10:22 2016 +0200
Committer: J�r�mie Fraudeau <je...@laposte.net>
Committed: Thu Sep 29 23:25:15 2016 +0200

----------------------------------------------------------------------
 .../rulesys/impl/TestLPBRuleEngine.java         | 37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/1b49b035/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/impl/TestLPBRuleEngine.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/impl/TestLPBRuleEngine.java b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/impl/TestLPBRuleEngine.java
index 12436f0..e7a061f 100644
--- a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/impl/TestLPBRuleEngine.java
+++ b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/impl/TestLPBRuleEngine.java
@@ -98,6 +98,43 @@ public class TestLPBRuleEngine extends TestCase {
 	}
 
 	@Test
+	public void testTabledGoalsLeak() throws Exception {
+		Graph data = Factory.createGraphMem();
+		data.add(new Triple(a, ty, C1));
+		List<Rule> rules = Rule
+				.parseRules("[r1:  (?x p ?t) <- (?x rdf:type C1), makeInstance(?x, p, C2, ?t)]"
+						+ "[r2:  (?t rdf:type C2) <- (?x rdf:type C1), makeInstance(?x, p, C2, ?t)]");
+
+		FBRuleInfGraph infgraph = (FBRuleInfGraph) createReasoner(rules).bind(
+				data);
+
+		LPBRuleEngine engine = getEngineForGraph(infgraph);
+		assertEquals(0, engine.activeInterpreters.size());
+		assertEquals(0, engine.tabledGoals.size());
+
+		ExtendedIterator<Triple> it = infgraph.find(a, ty, C1);
+		it.close();
+		// how many were cached
+		assertEquals(1, engine.tabledGoals.size());
+		// and no leaks of activeInterpreters
+		assertEquals(0, engine.activeInterpreters.size());
+
+		// Now ask again:
+		it = infgraph.find(a, ty, C1);
+		it.close();
+
+		// if it was a cache hit, no change here:
+		assertEquals(1, engine.tabledGoals.size());
+		assertEquals(0, engine.activeInterpreters.size());
+
+		//the cached generator should not have any consumingCP left
+		for(Generator generator : engine.tabledGoals.asMap().values()){
+			assertEquals(0, generator.consumingCPs.size());
+		}
+
+	}
+
+	@Test
 	public void testSaturateTabledGoals() throws Exception {
 		final int MAX = 1024;
 		// Set the cache size very small just for this test


[2/4] jena git commit: Resolve memory leak

Posted by de...@apache.org.
Resolve memory leak

Unregister ConsumerChoicePointFrame from Generator consumerCP uppon
closing


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/da6fff46
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/da6fff46
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/da6fff46

Branch: refs/heads/master
Commit: da6fff46b3383335bf58abe5e25f51cde8ebd51e
Parents: 1b49b03
Author: J�r�mie Fraudeau <je...@laposte.net>
Authored: Thu Sep 29 23:28:13 2016 +0200
Committer: J�r�mie Fraudeau <je...@laposte.net>
Committed: Thu Sep 29 23:28:13 2016 +0200

----------------------------------------------------------------------
 .../jena/reasoner/rulesys/impl/ConsumerChoicePointFrame.java  | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/da6fff46/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/ConsumerChoicePointFrame.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/ConsumerChoicePointFrame.java b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/ConsumerChoicePointFrame.java
index a1c2c26..cf662c2 100644
--- a/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/ConsumerChoicePointFrame.java
+++ b/jena-core/src/main/java/org/apache/jena/reasoner/rulesys/impl/ConsumerChoicePointFrame.java
@@ -164,8 +164,11 @@ public class ConsumerChoicePointFrame extends GenericTripleMatchFrame
     @Override
     public void close() {    	
     	super.close();
-    	if (generator != null && generator.interpreter != null) {
-    		generator.interpreter.close();
+    	if (generator != null) {
+            if(generator.interpreter != null) {
+                generator.interpreter.close();
+            }
+            generator.removeConsumer(this);
     		// .. but NOT 
     		//generator.setComplete();
     		// as it seems to cause other tests to fail


[4/4] jena git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/jena

Posted by de...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/jena


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/ec9573f2
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/ec9573f2
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/ec9573f2

Branch: refs/heads/master
Commit: ec9573f2a5a5ed8fc512dd2f6f5d36a061c1ac73
Parents: 9cec0c2 95235b8
Author: der <da...@epimorphics.com>
Authored: Thu Oct 6 14:56:35 2016 +0100
Committer: der <da...@epimorphics.com>
Committed: Thu Oct 6 14:56:35 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/jena/rdf/model/Model.java   | 23 ++++++++-
 .../org/apache/jena/rdf/model/Resource.java     | 14 +++++-
 .../apache/jena/rdf/model/impl/ModelCom.java    | 29 ++++++++----
 .../jena/rdf/model/impl/ResourceImpl.java       |  8 +++-
 jena-permissions/pom.xml                        | 32 +++++++++++++
 .../model/impl/SecuredModelImpl.java            | 49 ++++++++++++++++---
 .../model/impl/SecuredResourceImpl.java         | 50 ++++++++++++++++++--
 7 files changed, 183 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



[3/4] jena git commit: This closes #173

Posted by de...@apache.org.
This closes #173


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/9cec0c2e
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/9cec0c2e
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/9cec0c2e

Branch: refs/heads/master
Commit: 9cec0c2e5cbaff795f5e2d071d29d3efa32dfb37
Parents: 158b64d da6fff4
Author: der <da...@epimorphics.com>
Authored: Thu Oct 6 14:53:31 2016 +0100
Committer: der <da...@epimorphics.com>
Committed: Thu Oct 6 14:53:31 2016 +0100

----------------------------------------------------------------------
 .../rulesys/impl/ConsumerChoicePointFrame.java  |  7 ++--
 .../rulesys/impl/TestLPBRuleEngine.java         | 37 ++++++++++++++++++++
 2 files changed, 42 insertions(+), 2 deletions(-)
----------------------------------------------------------------------