[ sisc-Bugs-1684087 ] StackOverflowError when de/serializing

"SourceForge.net" <[email protected]> Mon, 19 Mar 2007 21:18:02 -0700
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
Bugs item #1684087, was opened at 2007-03-20 00:18
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1684087&group_id=23735

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alessandro Colomba (acolomba)
Assigned to: Nobody/Anonymous (nobody)
Summary: StackOverflowError when de/serializing

Initial Comment:
Serializing a long list produces a StackOverFlowError. Serializing and deserializing a shorter list fails if done twice in a row.


--8<----8<----8<----8<----8<----8<--
;; a utility module
(module ser-deser
  (ser deser ser-deser)

  (import s2j)

  (define-java-classes
    (<object-output-stream> |java.io.ObjectOutputStream|)
    (<file-output-stream> |java.io.FileOutputStream|)
    (<object-input-stream> |java.io.ObjectInputStream|)
    (<file-input-stream> |java.io.FileInputStream|))

  (define-generic-java-methods
    read-object write-object)

  (define (ser-deser value)
    (ser value)
    (deser))

  (define (ser value)
    (write-object (java-new <object-output-stream>
                            (java-new <file-output-stream>
                                      (->jstring "value.ser")))
                  (java-wrap value)))

  (define (deser)
    (java-unwrap (read-object (java-new <object-input-stream>
                                        (java-new <file-input-stream>
                                                  (->jstring "value.ser"))))))
  )

(import ser-deser)

(require-library 'sisc/libs/srfi/srfi-1)
(import srfi-1)


;; TEST CASE 1
(ser (iota 10000))
; => java.lang.StackOverflowError

;; TEST CASE 2
(ser (iota 10000)) ; => ok
(ser-deser (iota 10000)) ; => ok
(ser-deser (iota 10000)) ; => java.lang.StackOverflowError

;; TEST CASE 3

(ser-deser (fold (lambda (n acc) 
(make-child-environment acc)) (null-environment 0) (iota 1000)))
--8<----8<----8<----8<----8<----8<--


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=379534&aid=1684087&group_id=23735

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV