This page is no longer maintained — Please continue to the home page at www.scala-lang.org

scalac StackOverflowError

9 replies
Joachim Ansorg
Joined: 2008-12-19,
User offline. Last seen 42 years 45 weeks ago.

Hi,
after a refactoring of my Scala project's code I'm getting a
StackOverflowError from the compiler.
I'm using scalac 2.7.2.

I already tried a higher stack size and had a look at the -verbose output.
Nothing useful in there. Just a StackOverflowError at the end without any
syntax warnings.

In the past I had SEEs as well but knew what change caused this (most of the
time a list of many different Lift mapper classes). I changed too much code so
I don't know the reason this time.

How can I debug this and workaround that problem?

Joachim

P.S.:The beginning of the stacktrace:

[WARNING] Exception in thread "main" java.lang.StackOverflowError
[WARNING] at
scala.tools.nsc.symtab.Symbols$ClassSymbol.name(Symbols.scala:1524)
[WARNING] at
scala.tools.nsc.symtab.Symbols$Symbol.rawInfo(Symbols.scala:556)
[WARNING] at
scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:521)
[WARNING] at
scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
[WARNING] at
scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:3580)
[WARNING] at
scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:3505)
[WARNING] at
scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:12)
[WARNING] at scala.tools.nsc.symtab.Types$Type.
$less$colon$less(Types.scala:489)
[WARNING] at
scala.tools.nsc.symtab.Types$class.isSubArgs$1(Types.scala:3567)
[WARNING] at
scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:3573)
[WARNING] at
scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:3505)
[WARNING] at
scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:12)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$23.apply(Types.scala:3923)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$23.apply(Types.scala:3923)
[WARNING] at scala.List.filter(List.scala:852)
[WARNING] at
scala.tools.nsc.symtab.Types$class.elimSub0$1(Types.scala:3923)
[WARNING] at
scala.tools.nsc.symtab.Types$class.elimSub(Types.scala:3926)
[WARNING] at
scala.tools.nsc.symtab.Types$class.lubList(Types.scala:3864)
[WARNING] at
scala.tools.nsc.symtab.Types$class.lubBaseTypeSeq(Types.scala:3870)
[WARNING] at scala.tools.nsc.symtab.Types$class.lub0$1(Types.scala:3971)
[WARNING] at scala.tools.nsc.symtab.Types$class.lub(Types.scala:4034)
[WARNING] at
scala.tools.nsc.symtab.SymbolTable.lub(SymbolTable.scala:12)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4180)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4171)
[WARNING] at scala.List$.map2(List.scala:326)
[WARNING] at
scala.tools.nsc.symtab.Types$class.mergePrefixAndArgs(Types.scala:4170)
[WARNING] at
scala.tools.nsc.symtab.SymbolTable.mergePrefixAndArgs(SymbolTable.scala:12)
[WARNING] at
scala.tools.nsc.symtab.BaseTypeSeqs$BaseTypeSeq.apply(BaseTypeSeqs.scala:45)
[WARNING] at
scala.tools.nsc.symtab.Types$CompoundType.baseType(Types.scala:1097)
[WARNING] at
scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
[WARNING] at
scala.tools.nsc.symtab.Types$SimpleTypeProxy$class.baseType(Types.scala:161)
[WARNING] at
scala.tools.nsc.symtab.Types$SingletonType.baseType(Types.scala:840)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.base(Types.scala:2631)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.toPrefix$1(Types.scala:2655)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2656)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
[WARNING] at
scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2298)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2708)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
[WARNING] at
scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2343)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2708)
[WARNING] at
scala.tools.nsc.symtab.Types$Type.asSeenFrom(Types.scala:399)
[WARNING] at
scala.tools.nsc.symtab.Types$Type.memberType(Types.scala:429)
[WARNING] at
scala.tools.nsc.symtab.Types$Type.findMember(Types.scala:696)
[WARNING] at
scala.tools.nsc.symtab.Types$Type.nonPrivateMember(Types.scala:378)
[WARNING] at
scala.tools.nsc.symtab.Types$class.specializesSym(Types.scala:3688)
[WARNING] at
scala.tools.nsc.symtab.SymbolTable.specializesSym(SymbolTable.scala:12)
[WARNING] at
scala.tools.nsc.symtab.Types$Type.specializes(Types.scala:506)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$38$$anonfun$apply$15.apply(Types.scala:4109)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$38$$anonfun$apply$15.apply(Types.scala:4108)
[WARNING] at scala.List.foreach(List.scala:834)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4108)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4108)
[WARNING] at scala.List.foreach(List.scala:834)
[WARNING] at scala.tools.nsc.symtab.Types$class.glb0$1(Types.scala:4108)
[WARNING] at
scala.tools.nsc.symtab.Types$class.scala$tools$nsc$symtab$Types$$glb(Types.scala:4128)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4181)
[WARNING] at
scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4171)
[WARNING] at scala.List$.map2(List.scala:326)
[WARNING] at
scala.tools.nsc.symtab.Types$class.mergePrefixAndArgs(Types.scala:4170)
[WARNING] at
scala.tools.nsc.symtab.SymbolTable.mergePrefixAndArgs(SymbolTable.scala:12)
[WARNING] at
scala.tools.nsc.symtab.BaseTypeSeqs$BaseTypeSeq.apply(BaseTypeSeqs.scala:45)
[WARNING] at
scala.tools.nsc.symtab.Types$CompoundType.baseType(Types.scala:1097)
[WARNING] at
scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
[WARNING] at
scala.tools.nsc.symtab.Types$SimpleTypeProxy$class.baseType(Types.scala:161)
[WARNING] at
scala.tools.nsc.symtab.Types$SingletonType.baseType(Types.scala:840)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.base(Types.scala:2631)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.toPrefix$1(Types.scala:2655)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2656)
[WARNING] at
scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)

Iulian Dragos
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac StackOverflowError

Does it look like an infinite loop? How are you compiling (ant or
command line)? What version of Java are you using? Under Windows,
there is a known bug in Java 5, stack size is ignored for the
primordial thread. More info here:
https://lampsvn.epfl.ch/trac/scala/ticket/1508

Cheers,
Iulian

On Fri, Dec 19, 2008 at 12:06 AM, Joachim Ansorg
wrote:
> Hi,
> after a refactoring of my Scala project's code I'm getting a
> StackOverflowError from the compiler.
> I'm using scalac 2.7.2.
>
> I already tried a higher stack size and had a look at the -verbose output.
> Nothing useful in there. Just a StackOverflowError at the end without any
> syntax warnings.
>
> In the past I had SEEs as well but knew what change caused this (most of the
> time a list of many different Lift mapper classes). I changed too much code so
> I don't know the reason this time.
>
> How can I debug this and workaround that problem?
>
> Joachim
>
> P.S.:The beginning of the stacktrace:
>
> [WARNING] Exception in thread "main" java.lang.StackOverflowError
> [WARNING] at
> scala.tools.nsc.symtab.Symbols$ClassSymbol.name(Symbols.scala:1524)
> [WARNING] at
> scala.tools.nsc.symtab.Symbols$Symbol.rawInfo(Symbols.scala:556)
> [WARNING] at
> scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:521)
> [WARNING] at
> scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:3580)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:3505)
> [WARNING] at
> scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:12)
> [WARNING] at scala.tools.nsc.symtab.Types$Type.
> $less$colon$less(Types.scala:489)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.isSubArgs$1(Types.scala:3567)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:3573)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:3505)
> [WARNING] at
> scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:12)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$23.apply(Types.scala:3923)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$23.apply(Types.scala:3923)
> [WARNING] at scala.List.filter(List.scala:852)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.elimSub0$1(Types.scala:3923)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.elimSub(Types.scala:3926)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.lubList(Types.scala:3864)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.lubBaseTypeSeq(Types.scala:3870)
> [WARNING] at scala.tools.nsc.symtab.Types$class.lub0$1(Types.scala:3971)
> [WARNING] at scala.tools.nsc.symtab.Types$class.lub(Types.scala:4034)
> [WARNING] at
> scala.tools.nsc.symtab.SymbolTable.lub(SymbolTable.scala:12)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4180)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4171)
> [WARNING] at scala.List$.map2(List.scala:326)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.mergePrefixAndArgs(Types.scala:4170)
> [WARNING] at
> scala.tools.nsc.symtab.SymbolTable.mergePrefixAndArgs(SymbolTable.scala:12)
> [WARNING] at
> scala.tools.nsc.symtab.BaseTypeSeqs$BaseTypeSeq.apply(BaseTypeSeqs.scala:45)
> [WARNING] at
> scala.tools.nsc.symtab.Types$CompoundType.baseType(Types.scala:1097)
> [WARNING] at
> scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
> [WARNING] at
> scala.tools.nsc.symtab.Types$SimpleTypeProxy$class.baseType(Types.scala:161)
> [WARNING] at
> scala.tools.nsc.symtab.Types$SingletonType.baseType(Types.scala:840)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.base(Types.scala:2631)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.toPrefix$1(Types.scala:2655)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2656)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
> [WARNING] at
> scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2298)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2708)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
> [WARNING] at
> scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2343)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2708)
> [WARNING] at
> scala.tools.nsc.symtab.Types$Type.asSeenFrom(Types.scala:399)
> [WARNING] at
> scala.tools.nsc.symtab.Types$Type.memberType(Types.scala:429)
> [WARNING] at
> scala.tools.nsc.symtab.Types$Type.findMember(Types.scala:696)
> [WARNING] at
> scala.tools.nsc.symtab.Types$Type.nonPrivateMember(Types.scala:378)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.specializesSym(Types.scala:3688)
> [WARNING] at
> scala.tools.nsc.symtab.SymbolTable.specializesSym(SymbolTable.scala:12)
> [WARNING] at
> scala.tools.nsc.symtab.Types$Type.specializes(Types.scala:506)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$38$$anonfun$apply$15.apply(Types.scala:4109)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$38$$anonfun$apply$15.apply(Types.scala:4108)
> [WARNING] at scala.List.foreach(List.scala:834)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4108)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4108)
> [WARNING] at scala.List.foreach(List.scala:834)
> [WARNING] at scala.tools.nsc.symtab.Types$class.glb0$1(Types.scala:4108)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.scala$tools$nsc$symtab$Types$$glb(Types.scala:4128)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4181)
> [WARNING] at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4171)
> [WARNING] at scala.List$.map2(List.scala:326)
> [WARNING] at
> scala.tools.nsc.symtab.Types$class.mergePrefixAndArgs(Types.scala:4170)
> [WARNING] at
> scala.tools.nsc.symtab.SymbolTable.mergePrefixAndArgs(SymbolTable.scala:12)
> [WARNING] at
> scala.tools.nsc.symtab.BaseTypeSeqs$BaseTypeSeq.apply(BaseTypeSeqs.scala:45)
> [WARNING] at
> scala.tools.nsc.symtab.Types$CompoundType.baseType(Types.scala:1097)
> [WARNING] at
> scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
> [WARNING] at
> scala.tools.nsc.symtab.Types$SimpleTypeProxy$class.baseType(Types.scala:161)
> [WARNING] at
> scala.tools.nsc.symtab.Types$SingletonType.baseType(Types.scala:840)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.base(Types.scala:2631)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.toPrefix$1(Types.scala:2655)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2656)
> [WARNING] at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
>
>
>

Joachim Ansorg
Joined: 2008-12-19,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac StackOverflowError

Iulian,
thank you for your reply.

> Does it look like an infinite loop?

Hm, I don't see one in the stacktrace.
But it still failed with 16 megabytes of stack trace so I guess there's an
infinite loop involved.

> How are you compiling (ant or
> command line)?

I'm using maven2 to compile it.

> What version of Java are you using?

Java 6u10 on Linux.

Thanks,
Joachim

loverdos
Joined: 2008-11-18,
User offline. Last seen 2 years 27 weeks ago.
Re: scalac StackOverflowError
I did get a (different) StackOverflow the other day.


Not the same methods in the trace (at first sight) but related to types.

Martin confirmed there is no such issue in trunk.

Just in case it might lead somewhere....

Christos

On Fri, Dec 19, 2008 at 12:28 PM, Joachim Ansorg <nospam@joachim-ansorg.de> wrote:
Iulian,
thank you for your reply.

> Does it look like an infinite loop?

Hm, I don't see one in the stacktrace.
But it still failed with 16 megabytes of stack trace so I guess there's an
infinite loop involved.

> How are you compiling (ant or
> command line)?

I'm using maven2 to compile it.

> What version of Java are you using?

Java 6u10 on Linux.

Thanks,
Joachim



--
 __~O
-\ <,       Christos KK Loverdos
(*)/ (*)      http://ckkloverdos.com
Joachim Ansorg
Joined: 2008-12-19,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac StackOverflowError

Thanks for the link.
I've now compiled the code with the lateset 2.8.0-SNAPSHOT, which worked well.
After I fixed all syntax errors I switched back to 2.7.2 - which gets the
exception again.

The problem is that I don't know which line of the code is triggering that
error so I can't fix it.
Does anyone know how I could find that line so that I can continue coding?

Joachim

> I did get a (different) StackOverflow the other day.
> http://www.nabble.com/Re:-Type-inference-for-more-than-one-argument-list-p2
>1012827.html
>
> Not the same methods in the trace (at first sight) but related to types.
>
> Martin confirmed there is no such issue in trunk.
>
> Just in case it might lead somewhere....

Iulian Dragos
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac StackOverflowError

On Fri, Dec 19, 2008 at 11:28 AM, Joachim Ansorg
<nospam@joachim-ansorg.de> wrote:
> Iulian,
> thank you for your reply.
>
>> Does it look like an infinite loop?
>
> Hm, I don't see one in the stacktrace.
> But it still failed with 16 megabytes of stack trace so I guess there's an
> infinite loop involved.

Scalac is known to need a lot of stack space, try giving it 64M of
stack. It's interesting that the current trunk version succeeds, so it
might indeed be a bug that was fixed in the meantime. But we do use
64M for building the compiler itself.

>> What version of Java are you using?
>
> Java 6u10 on Linux.

Ok, that means it's unrelated to the JVM bug on Windows.

Cheers,
Iulian

>
> Thanks,
> Joachim
>

Joachim Ansorg
Joined: 2008-12-19,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac StackOverflowError

Hi,

> Scalac is known to need a lot of stack space, try giving it 64M of
> stack. It's interesting that the current trunk version succeeds, so it
> might indeed be a bug that was fixed in the meantime. But we do use
> 64M for building the compiler itself.

I tried that. It took about 10 times longer as before but still crashed with
that StackOverflowError.

I guess I have some time-consuming work to do to find the code which crashes
the compiler and to find a workaround.

Is the 2.8.0 release date planned yet? :)

Joachim

Ricky Clarkson
Joined: 2008-12-19,
User offline. Last seen 3 years 2 weeks ago.
Re: scalac StackOverflowError
Is your project public, so that others can try the compiler on it?  Or can you minimise it into a test case that you can send?

2008/12/19 Joachim Ansorg <nospam@joachim-ansorg.de>
Hi,

> Scalac is known to need a lot of stack space, try giving it 64M of
> stack. It's interesting that the current trunk version succeeds, so it
> might indeed be a bug that was fixed in the meantime. But we do use
> 64M for building the compiler itself.

I tried that. It took about 10 times longer as before but still crashed with
that StackOverflowError.

I guess I have some time-consuming work to do to find the code which crashes
the compiler and to find a workaround.

Is the 2.8.0 release date planned yet? :)

Joachim

Carsten Saager
Joined: 2008-12-19,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac StackOverflowError
I have as well a stack overflow (2.7.2-final Java 1.5_16 Win XP):

   [scalac] Compiling 4 scala and 84 java source files to ######\Deployment\config\tomcat\classes
   [scalac] Element '#####\${local.build.dir}' does not exist.
   [scalac] java.lang.StackOverflowError
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3038)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3323)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3380)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3382)
   [scalac]     at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:870)
   [scalac]     at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:415)
   [scalac]     at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:413)
   [scalac]     at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:982)
   [scalac]     at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:510)
   [scalac]     at scala.tools.nsc.typechecker.Contexts$ImportInfo.qual(Contexts.scala:584)
   [scalac]     at scala.tools.nsc.typechecker.Contexts$ImportInfo.importedSymbol(Contexts.scala:603)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedIdent$1(Typers.scala:2901)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3252)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3323)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3380)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3240)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3323)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3380)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3240)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3323)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3380)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3240)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3323)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3380)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3240)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3323)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3380)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3240)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:3323)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3380)
   [scalac]     at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:3382)
   [scalac]     at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:870)
   [scalac]     at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:415)
   [scalac]     at scala.tools.nsc.typechecker.Namers$Namer$$anonfun$typeCompleter$1.apply(Namers.scala:413)
   [scalac]     at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:982)
   [scalac]     at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:510)
... + some

I managed with some "partial compiles" to compile and test the project with the Eclipse plugin. I tried running with JDK6 with larger stack, but no luck either.

Unfortunately the project is closed source and this project here depends on some million lines of other proprietary Java code. The compiler doesn't emit any information, so I have hard time to create a scenario.

I'll try Scala 2.8 now ....

/Carsten

On Fri, Dec 19, 2008 at 12:29 AM, Iulian Dragos <jaguarul@gmail.com> wrote:
Does it look like an infinite loop? How are you compiling (ant or
command line)? What version of Java are you using? Under Windows,
there is a known bug in Java 5, stack size is ignored for the
primordial thread. More info here:
https://lampsvn.epfl.ch/trac/scala/ticket/1508

Cheers,
Iulian

On Fri, Dec 19, 2008 at 12:06 AM, Joachim Ansorg
<nospam@joachim-ansorg.de> wrote:
> Hi,
> after a refactoring of my Scala project's code I'm getting a
> StackOverflowError from the compiler.
> I'm using scalac 2.7.2.
>
> I already tried a higher stack size and had a look at the -verbose output.
> Nothing useful in there. Just a StackOverflowError at the end without any
> syntax warnings.
>
> In the past I had SEEs as well but knew what change caused this (most of the
> time a list of many different Lift mapper classes). I changed too much code so
> I don't know the reason this time.
>
> How can I debug this and workaround that problem?
>
> Joachim
>
> P.S.:The beginning of the stacktrace:
>
> [WARNING] Exception in thread "main" java.lang.StackOverflowError
> [WARNING]       at
> scala.tools.nsc.symtab.Symbols$ClassSymbol.name(Symbols.scala:1524)
> [WARNING]       at
> scala.tools.nsc.symtab.Symbols$Symbol.rawInfo(Symbols.scala:556)
> [WARNING]       at
> scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:521)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:3580)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:3505)
> [WARNING]       at
> scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:12)
> [WARNING]       at scala.tools.nsc.symtab.Types$Type.
> $less$colon$less(Types.scala:489)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.isSubArgs$1(Types.scala:3567)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.isSubType0(Types.scala:3573)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.isSubType(Types.scala:3505)
> [WARNING]       at
> scala.tools.nsc.symtab.SymbolTable.isSubType(SymbolTable.scala:12)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$23.apply(Types.scala:3923)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$23.apply(Types.scala:3923)
> [WARNING]       at scala.List.filter(List.scala:852)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.elimSub0$1(Types.scala:3923)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.elimSub(Types.scala:3926)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.lubList(Types.scala:3864)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.lubBaseTypeSeq(Types.scala:3870)
> [WARNING]       at scala.tools.nsc.symtab.Types$class.lub0$1(Types.scala:3971)
> [WARNING]       at scala.tools.nsc.symtab.Types$class.lub(Types.scala:4034)
> [WARNING]       at
> scala.tools.nsc.symtab.SymbolTable.lub(SymbolTable.scala:12)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4180)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4171)
> [WARNING]       at scala.List$.map2(List.scala:326)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.mergePrefixAndArgs(Types.scala:4170)
> [WARNING]       at
> scala.tools.nsc.symtab.SymbolTable.mergePrefixAndArgs(SymbolTable.scala:12)
> [WARNING]       at
> scala.tools.nsc.symtab.BaseTypeSeqs$BaseTypeSeq.apply(BaseTypeSeqs.scala:45)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$CompoundType.baseType(Types.scala:1097)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$SimpleTypeProxy$class.baseType(Types.scala:161)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$SingletonType.baseType(Types.scala:840)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.base(Types.scala:2631)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.toPrefix$1(Types.scala:2655)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2656)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2298)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2708)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:2343)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2708)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$Type.asSeenFrom(Types.scala:399)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$Type.memberType(Types.scala:429)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$Type.findMember(Types.scala:696)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$Type.nonPrivateMember(Types.scala:378)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.specializesSym(Types.scala:3688)
> [WARNING]       at
> scala.tools.nsc.symtab.SymbolTable.specializesSym(SymbolTable.scala:12)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$Type.specializes(Types.scala:506)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$38$$anonfun$apply$15.apply(Types.scala:4109)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$38$$anonfun$apply$15.apply(Types.scala:4108)
> [WARNING]       at scala.List.foreach(List.scala:834)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4108)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$38.apply(Types.scala:4108)
> [WARNING]       at scala.List.foreach(List.scala:834)
> [WARNING]       at scala.tools.nsc.symtab.Types$class.glb0$1(Types.scala:4108)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.scala$tools$nsc$symtab$Types$$glb(Types.scala:4128)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4181)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$$anonfun$41.apply(Types.scala:4171)
> [WARNING]       at scala.List$.map2(List.scala:326)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$class.mergePrefixAndArgs(Types.scala:4170)
> [WARNING]       at
> scala.tools.nsc.symtab.SymbolTable.mergePrefixAndArgs(SymbolTable.scala:12)
> [WARNING]       at
> scala.tools.nsc.symtab.BaseTypeSeqs$BaseTypeSeq.apply(BaseTypeSeqs.scala:45)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$CompoundType.baseType(Types.scala:1097)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1463)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$SimpleTypeProxy$class.baseType(Types.scala:161)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$SingletonType.baseType(Types.scala:840)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.base(Types.scala:2631)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.toPrefix$1(Types.scala:2655)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2656)
> [WARNING]       at
> scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:2575)
>
>
>



--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais

Joachim Ansorg
Joined: 2008-12-19,
User offline. Last seen 42 years 45 weeks ago.
Re: scalac StackOverflowError

Hi,

> Is your project public, so that others can try the compiler on it? Or can
> you minimise it into a test case that you can send?

No, the project is not public.
But I fixed it now. I used the 2.8-SNAPSHOT compiler to compile all sources,
switched back to 2.7.2 and then changed the files one by one to find the
problematic line by compiling only the changed file
The reason was a line "can1 or can2". I guess the compiler failed to infere a
type for that code. Since it'll work in 2.8 I can live with it for now.

Joachim

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland