Repository: incubator-systemml Updated Branches: refs/heads/master 6ad5509bd -> 93ada6291
[SYSTEMML-1616] Fix constant folding leaks for multi-threaded JMLC In scenarios with multiple concurrently running JMLC connections and prepared scripts per JVM process (e.g., in spark executors, or multi-threaded containers), there are potential side effects between scripts which ultimately can lead to compilation and runtime errors. The root cause are static reuse objects (for program block and execution context) in the constant folding rewrite. Accordingly, folded constants might leak from one script compilation into another script compilation which can cause all sorts of incomprehensible errors. This patch fixes this leak by reusing these objects per program rewriter, i.e., across statement blocks but not across scripts. Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/93ada629 Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/93ada629 Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/93ada629 Branch: refs/heads/master Commit: 93ada6291a7e95af01d39e8eb39a16672696145f Parents: 6ad5509 Author: Matthias Boehm <mboe...@gmail.com> Authored: Mon May 22 19:23:26 2017 -0700 Committer: Matthias Boehm <mboe...@gmail.com> Committed: Mon May 22 19:39:14 2017 -0700 ---------------------------------------------------------------------- .../apache/sysml/hops/rewrite/RewriteConstantFolding.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/93ada629/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java b/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java index afb982c..ac38138 100644 --- a/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java +++ b/src/main/java/org/apache/sysml/hops/rewrite/RewriteConstantFolding.java @@ -58,8 +58,8 @@ public class RewriteConstantFolding extends HopRewriteRule private static final String TMP_VARNAME = "__cf_tmp"; //reuse basic execution runtime - private static ProgramBlock _tmpPB = null; - private static ExecutionContext _tmpEC = null; + private ProgramBlock _tmpPB = null; + private ExecutionContext _tmpEC = null; @Override @@ -232,7 +232,7 @@ public class RewriteConstantFolding extends HopRewriteRule return literal; } - private static ProgramBlock getProgramBlock() + private ProgramBlock getProgramBlock() throws DMLRuntimeException { if( _tmpPB == null ) @@ -240,7 +240,7 @@ public class RewriteConstantFolding extends HopRewriteRule return _tmpPB; } - private static ExecutionContext getExecutionContext() + private ExecutionContext getExecutionContext() { if( _tmpEC == null ) _tmpEC = ExecutionContextFactory.createContext();