Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-6961

List serialization/deserialization can overflow the stack

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Scala 2.10.0
    • Fix Version/s: Scala 2.10.1
    • Component/s: None

      Description

      Compiling and running this program will result in the issue that it overflows the stack at runtime in 2.10 but not in 2.9. Please fix this - it's a critical bug.

      object ListSer extends App {
       
        val largeList = (1 to 1000000).toList
       
        val oos = new ObjectOutputStream(new FileOutputStream("C:/tmp/largeList.ser"))
        oos.writeObject(largeList)
        oos.flush()
        oos.close()
       
        val ois = new ObjectInputStream(new FileInputStream("C:/tmp/largeList.ser"))
        val read = ois.readObject().asInstanceOf[List[Int]]
        println(read.size)
       
       
      }
      

      Here is the stack trace:

              at scala.collection.immutable.$colon$colon.readObject(List.scala:362)
              at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:601)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
              at scala.collection.immutable.$colon$colon.readObject(List.scala:362)
              at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:601)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
              at scala.collection.immutable.$colon$colon.readObject(List.scala:362)
              at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:601)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
              at scala.collection.immutable.$colon$colon.readObject(List.scala:362)
              at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:601)
              at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004)
              at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347)
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                prokopec Aleksandar Prokopec
                Reporter:
                oxbow_lakes Chris Marshall
              • Votes:
                0 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: