OOME when working with MD5 digest
---------------------------------
Key: JRUBY-3359
URL: http://jira.codehaus.org/browse/JRUBY-3359
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.1.6
Environment: jdk6 on mac
Reporter: Igor Minar
Assignee: Thomas E Enebo
{code:title=testcase}
require 'digest/md5'
hasher = Digest::MD5.new
File.open('/some/4gb.file' ,'r') do |f|
while(!f.eof)
buffer = f.readpartial(5000)
hasher.update(buffer)
end
end
{code}
{noformat:title=error message}
Error: Your application used more memory than the safety cap of 500m.
Specify -J-Xmx####m to increase it (#### = cap size in MB).
Specify -w for full OutOfMemoryError stack trace
{noformat}
{noformat:title=OOME stacktrace}
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
at java.lang.StringBuffer.append(StringBuffer.java:219)
at org.jruby.RubyDigest$Base.update(RubyDigest.java:226)
at
org.jruby.RubyDigest$Base$i_method_1_0$RUBYINVOKER$update.call(org/jruby/RubyDigest$Base$i_method_1_0$RUBYINVOKER$update.gen)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:114)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:68)
at org.jruby.ast.WhileNode.interpret(WhileNode.java:128)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at
org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:202)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:153)
at org.jruby.runtime.Block.yield(Block.java:120)
at org.jruby.RubyIO.open(RubyIO.java:879)
at
org.jruby.RubyIO$s_method_0_2$RUBYFRAMEDINVOKER$open.call(org/jruby/RubyIO$s_method_0_2$RUBYFRAMEDINVOKER$open.gen)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:261)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:310)
at
org.jruby.runtime.callsite.CachingCallSite.callIter(CachingCallSite.java:182)
at
org.jruby.ast.CallTwoArgBlockNode.interpret(CallTwoArgBlockNode.java:62)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at org.jruby.ast.RootNode.interpret(RootNode.java:126)
at
org.jruby.evaluator.ASTInterpreter.evalWithBinding(ASTInterpreter.java:122)
at org.jruby.RubyKernel.eval(RubyKernel.java:881)
at
org.jruby.RubyKernel$s_method_0_3$RUBYFRAMEDINVOKER$eval.call(org/jruby/RubyKernel$s_method_0_3$RUBYFRAMEDINVOKER$eval.gen)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:136)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:32)
at org.jruby.ast.FCallManyArgsNode.interpret(FCallManyArgsNode.java:60)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:101)
at
org.jruby.internal.runtime.methods.DefaultMethod.interpretedCall(DefaultMethod.java:156)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:133)
{noformat}
the testcase works fine with MRI
Also when I remove the md5 code it works fine even with jruby:
{code}
File.open('/some/4gb.file' ,'r') do |f|
while(!f.eof)
buffer = f.readpartial(5000)
end
end
{code}
>From the stack trace it looks like StringBuilder is being used to to
>concatenate the input, instead of generating md5 on the fly from chunks.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email