-
Notifications
You must be signed in to change notification settings - Fork 1.1k
OOME / children of class {enum} were already queried before value {case} was discovered #9064
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
Comments
I will check as soon as these changes get to the nightly build, which seems to be currently lagging behind a week. (maybe ccing #8734?) |
Thanks for the heads up, fixed in #9101 |
@anatoliykmetyuk well, using |
I'm guessing from the stack trace you have an inline def which recursively calls itself and ends up being recursively inlined an infinite amount of time (I didn't check but |
@smarter thx for the tip, it's actually the following bad boy which is causing the issue The following does not compile: try
val value = mirror.fromProduct(Product0).asInstanceOf[E]
_fromName[E,ts,ls](i+1) + (key -> value)
catch
// ignoring parametric types...
// Tuple.Size[mirror.MirrorElemLabels] does not work since the type info gets lost
case _:IndexOutOfBoundsException => _fromName[E,ts,ls](i+1) Please mention the wierd try-catch, which is an workaround for the Rewriting it to val additional =
try
val value = mirror.fromProduct(Product0).asInstanceOf[E]
Map(key -> value)
catch
// // ignoring parametric types...
// // Tuple.Size[mirror.MirrorElemLabels] does not work since the type info gets lost
case _:IndexOutOfBoundsException => Map.empty
_fromName[E,ts,ls] ++ additional Hence both
are fixed now. 🥳 Thx. The Enum in question had 18 cases (hence the limit was not reached) yet 2^18 of copies of itself was apparently just .... waaay to much. There could be a warning for "recursive inline method calls itself more than once". I might not be the last person doing this mistake. |
Yeah, there's a |
In letalvoj/loonyssh/tree/bug-report I am getting either
or
java.lang.OutOfMemoryError
.The
EncryptionAlgorithm
is anenum
andcast128-cbc
is one of it's cases. It is used inside a case of yet anotherenum SSHMsg
The proposed remedy is not helpful much, since I can hardly do anything with nesting of the values in the enum.
I tried to minimize the example but it did not work.
Beware! Once the build passes due to some changes in code (like commenting out the cause) it continues to pass long even when it should not due to incremental compilation. It is enough to run
;clean;compile
and the build starts failing again.Implicits involved in
children of ...
The following chain of givens is involved when the issue emerges:
SSHReader[SSHMsg.KexInit]
Reader.scala#L101SSHReader[NameList[EncryptionAlgorithm]]
Reader.scala#L118EnumSupport[EncryptionAlgorithm]
EnumSupport.scala#L13Mirror.SumOf[EncryptionAlgorithm]
Funny enough - if the
NameList[EncryptionAlgorithm]
is not nested insideSSHMsg.KexInit
then the 2ndsummon[SSHReader[NameList[EncryptionAlgorithm]]]
compiles just fine.Attempted fixes
EncryptionAlgorithm
to the same file whereSSHMsg.KexInit
, which did not helpenum
s and other data structures to a separate module fixes the isue but it hangs the compilation. After several minutes I getProfiling the compilation in the case of
java.lang.OutOfMemoryError
Those are the objects which eat all the memory:

This seems to be the thread which produces them:

The text was updated successfully, but these errors were encountered: