New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in iteratees (recursive Future.flatMap) #1084
Milestone
Comments
ghost
assigned richdougherty
May 2, 2013
See Scala issue: https://issues.scala-lang.org/browse/SI-7336 |
@jroper, @huntc: I think we can upgrade to Scala 2.10.3-RC2 on master now to get this fix in. We could verify the fix with a test like this: https://github.com/richdougherty/scala/blob/48c677ceb3177d93e700b399c00af6b8bb6419e4/test/files/run/t7336 |
richdougherty
added a commit
to richdougherty/playframework
that referenced
this issue
Sep 24, 2013
Scala 2.10.3 inclues a fix that allows memory to be freed when chaining Future.flatMap calls (SI-7336). Iteratees make extensive use of Future.flatMap, so upgrading to Scala 2.10.3 allows us to avoid memory leaks when using iteratees (playframework#1084). Memory leaks can occur when processing large amounts of data or when working with connections that can remain open for a long time.
Fixed by #1735. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code results in an
OutOfMemoryError
:Raised by @jroper on the dev mailing list: https://groups.google.com/d/topic/play-framework-dev/58VZD-YXdJw/discussion
The problem seems to be caused by using calling
Future.flatMap
recursively, which causes chains of completion handlers to grow to an unbounded size. See the mailing list discussion for more info.A solution may be to avoid
Future.flatMap
by building asynchronous computations out of some other type and converting it to aFuture
at the last minute. This will allow us to avoid building chains of completion handlers. See, eg: richdougherty@396e425The text was updated successfully, but these errors were encountered: