RC-Paves3-build / plovr

Automatically exported from code.google.com/p/plovr
0 stars 0 forks source link

Out of memory error #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

It's hard to say, but our codebase is about 6,000 lines of Closure code.

What is the expected output? What do you see instead?

I'm getting java.lang.OutOfMemoryErrors. Another staff member working on the 
same codebase is also getting the same error.

What version of the product are you using? On what operating system?

Latest build of plovr (downloaded yesterday). I was using an older version 
before that, and not getting these errors. (I upgraded because the older build 
I was using was missing .addButton for dialog boxes.) 

Mac OS X 10.6.6

Please provide any additional information below.

Exception in thread "pool-1-thread-4" java.lang.OutOfMemoryError: Java heap 
space
    at java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:39)
    at java.nio.ByteBuffer.allocate(ByteBuffer.java:312)
    at sun.net.httpserver.Request$WriteStream.<init>(Request.java:366)
    at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:428)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Mar 19, 2011 10:43:01 AM org.plovr.AbstractGetHandler handle
SEVERE: Error during GET request to /compile?id=sop-admin
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
    at com.google.javascript.jscomp.Compiler.runCallable(Compiler.java:595)
    at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:541)
    at com.google.javascript.jscomp.Compiler.compile(Compiler.java:524)
    at com.google.javascript.jscomp.Compiler.compile(Compiler.java:483)
    at org.plovr.Compilation.compile(Compilation.java:92)
    at org.plovr.Compilation.compile(Compilation.java:79)
    at org.plovr.CompileRequestHandler.compile(CompileRequestHandler.java:97)
    at org.plovr.CompileRequestHandler.compile(CompileRequestHandler.java:117)
    at org.plovr.CompileRequestHandler.doGet(CompileRequestHandler.java:76)
    at org.plovr.AbstractGetHandler.handle(AbstractGetHandler.java:86)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
    at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:65)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:68)
    at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:555)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
    at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:527)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at com.google.common.collect.Maps.newHashMap(Maps.java:82)
    at com.google.javascript.jscomp.LinkedFlowScope.allFlowSlots(LinkedFlowScope.java:341)
    at com.google.javascript.jscomp.LinkedFlowScope.access$500(LinkedFlowScope.java:39)
    at com.google.javascript.jscomp.LinkedFlowScope$FlatFlowScopeCache.<init>(LinkedFlowScope.java:422)
    at com.google.javascript.jscomp.LinkedFlowScope$FlowScopeJoinOp.apply(LinkedFlowScope.java:248)
    at com.google.javascript.jscomp.LinkedFlowScope$FlowScopeJoinOp.apply(LinkedFlowScope.java:236)
    at com.google.javascript.jscomp.JoinOp$BinaryJoinOp.apply(JoinOp.java:45)
    at com.google.javascript.jscomp.JoinOp$BinaryJoinOp.apply(JoinOp.java:33)
    at com.google.javascript.jscomp.DataFlowAnalysis$BranchedForwardDataFlowAnalysis.joinInputs(DataFlowAnalysis.java:475)
    at com.google.javascript.jscomp.DataFlowAnalysis.analyze(DataFlowAnalysis.java:211)
    at com.google.javascript.jscomp.DataFlowAnalysis.analyze(DataFlowAnalysis.java:180)
    at com.google.javascript.jscomp.TypeInferencePass.inferTypes(TypeInferencePass.java:108)
    at com.google.javascript.jscomp.TypeInferencePass$TypeInferringCallback.exitScope(TypeInferencePass.java:132)
    at com.google.javascript.jscomp.NodeTraversal.popScope(NodeTraversal.java:544)
    at com.google.javascript.jscomp.NodeTraversal.traverseFunction(NodeTraversal.java:504)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:449)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:457)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:457)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:457)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:457)
    at com.google.javascript.jscomp.NodeTraversal.traverseBranch(NodeTraversal.java:457)
    at com.google.javascript.jscomp.NodeTraversal.traverseWithScope(NodeTraversal.java:312)
    at com.google.javascript.jscomp.TypeInferencePass.inferTypes(TypeInferencePass.java:90)
    at com.google.javascript.jscomp.TypeInferencePass.process(TypeInferencePass.java:83)
    at com.google.javascript.jscomp.DefaultPassConfig$21$1.process(DefaultPassConfig.java:992)
    at com.google.javascript.jscomp.PhaseOptimizer$PassFactoryDelegate.processInternal(PhaseOptimizer.java:271)
    at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:248)
    at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:167)
    at com.google.javascript.jscomp.Compiler.check(Compiler.java:699)
    at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:618)
    at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:66)
    at com.google.javascript.jscomp.Compiler$1.call(Compiler.java:526)
Mar 19, 2011 10:43:01 AM org.plovr.AbstractGetHandler handle
SEVERE: Error during GET request to /compile?id=sop-public
java.lang.RuntimeException: java.lang.OutOfMemoryError: Java heap space
    at com.google.javascript.jscomp.Compiler.runCallable(Compiler.java:595)
    at com.google.javascript.jscomp.Compiler.runInCompilerThread(Compiler.java:541)
    at com.google.javascript.jscomp.Compiler.compile(Compiler.java:524)
    at com.google.javascript.jscomp.Compiler.compile(Compiler.java:483)
    at org.plovr.Compilation.compile(Compilation.java:92)
    at org.plovr.Compilation.compile(Compilation.java:79)
    at org.plovr.CompileRequestHandler.compile(CompileRequestHandler.java:97)
    at org.plovr.CompileRequestHandler.compile(CompileRequestHandler.java:117)
    at org.plovr.CompileRequestHandler.doGet(CompileRequestHandler.java:76)
    at org.plovr.AbstractGetHandler.handle(AbstractGetHandler.java:86)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
    at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:65)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:68)
    at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:555)
    at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:65)
    at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:527)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at com.google.javascript.jscomp.mozilla.rhino.Parser.recordComment(Parser.java:284)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.peekToken(Parser.java:337)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.matchToken(Parser.java:379)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.ifStatement(Parser.java:1132)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.statementHelper(Parser.java:996)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.statement(Parser.java:950)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.parseFunctionBody(Parser.java:651)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.function(Parser.java:836)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.primaryExpr(Parser.java:2804)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.memberExpr(Parser.java:2465)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.unaryExpr(Parser.java:2375)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.mulExpr(Parser.java:2298)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.addExpr(Parser.java:2280)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.shiftExpr(Parser.java:2259)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.relExpr(Parser.java:2232)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.eqExpr(Parser.java:2202)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.bitAndExpr(Parser.java:2189)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.bitXorExpr(Parser.java:2176)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.bitOrExpr(Parser.java:2163)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.andExpr(Parser.java:2150)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.orExpr(Parser.java:2137)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.condExpr(Parser.java:2113)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.assignExpr(Parser.java:2082)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.assignExpr(Parser.java:2094)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.expr(Parser.java:2059)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.nameOrLabel(Parser.java:1817)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.statementHelper(Parser.java:1081)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.statement(Parser.java:950)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.parse(Parser.java:567)
    at com.google.javascript.jscomp.mozilla.rhino.Parser.parse(Parser.java:505)
    at com.google.javascript.jscomp.parsing.ParserRunner.parse(ParserRunner.java:106)
    at com.google.javascript.jscomp.JsAst.parse(JsAst.java:88)
Mar 19, 2011 10:43:51 AM org.plovr.Config getCompilerOptions

Original issue reported on code.google.com by mickn...@gmail.com on 18 Mar 2011 at 11:57

GoogleCodeExporter commented 8 years ago
Potentially related - we're noticing that plovr is recompiling even when the 
base files don't change. Is this expected?

Original comment by mickn...@gmail.com on 19 Mar 2011 at 12:01

GoogleCodeExporter commented 8 years ago
As with most java apps, you have to explicitly give the VM more ram. We had to 
do this recently with our codebase as well, which is roughly the same size as 
yours.

Basically when you run java you give it the highly memorable -Xmx arg followed 
by the megabytes of ram you need. We're currently using 256, which seems to do 
the trick:

java -Xmx256m -jar /my/path/to/plovr.jar serve my-plovr-config.js

Original comment by andydun...@gmail.com on 23 Mar 2011 at 5:36

GoogleCodeExporter commented 8 years ago
Thanks Andy. Yes, that should fix the problem. I guess I'm worried though, 
should it be recompiling the binaries every time -- even if there hasn't been 
any change to the source files? I see there is a "fingerprint" option, but that 
seems to be limited to modules? For a dynamic standalone app, recompiling every 
reload is okay -- but with a regular website it becomes painful slow.

Original comment by mickn...@gmail.com on 24 Mar 2011 at 2:17

GoogleCodeExporter commented 8 years ago
Yes, java -Xmx is definitely the fix for your problem. At work, we are 
compiling 76,000 lines of our own JS (so that's in addition to all of the code 
from the Closure Library that we pull in) and 12,000 lines of Closure 
Templates, and we use -Xmx500M when we call plovr.

You probably want to follow Issue #5: "Recompile only if source files have 
changed" (http://code.google.com/p/plovr/issues/detail?id=5). Unfortunately, I 
haven't gotten around to it yet. The simple fix is to keep track of the 
manifest and last modified times for all of the files, though I think the more 
interesting (and stronger) fix is to cache more work done by the Compiler, such 
as parsing.

Obviously Issue #5 is still open, but I am going to mark this one as closed.

Original comment by bolinf...@gmail.com on 24 Apr 2011 at 2:33