Opened 13 years ago

Closed 13 years ago

Last modified 11 years ago

#531 closed defect (fixed)

"Snowdigest" egg causes stack overflow error in tests with experimental

Reported by: sjamaan Owned by: felix winkelmann
Priority: critical Milestone: 4.9.0
Component: core libraries Version: 4.6.x
Keywords: stack overflow Cc:
Estimated difficulty:


$ /home/sjamaan/chicken-test/bin/csi -s run.scm

Error: stack overflow

        Call history:

        <eval>    [t] (print md)
        <eval>    [t] (string-ci=? md expect)
        <eval>    [t] (car v)
        <eval>    [t] (cadr v)
        <eval>    [t] (caddr v)
        <eval>    [t] (cadddr v)
        <eval>    [t] (= repeat 0)
        <eval>    [t] (digest-string str2 algorithm (quote hex))
        <eval>    [t] (print md)
        <eval>    [t] (string-ci=? md expect)
        <eval>    [t] (car v)
        <eval>    [t] (cadr v)
        <eval>    [t] (caddr v)
        <eval>    [t] (cadddr v)
        <eval>    [t] (= repeat 0)
        <eval>    [t] (digest-string str2 algorithm (quote hex))        <--

This happened on NetBSD/amd64 with experimental (4.6.6). Doesn't happen under 4.6.0

I tagged it as a "core libraries" error, since I assume it's a bug in Chicken, not snowdigest.

Change History (3)

comment:1 Changed 13 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

The problem appears to be that the internal calculation-routines in snowdigest are optimized into non-CPS "direct" calls (this code is very tight and does lots of fixnum-arithmetic). It is also recursive, so, depending on initial stack size, it may happen that the recursive direct-style part is running while the stack is already relatively near to the limit (i.e. shortly before CPS-code would trigger a minor GC). I have raised the size of the "reserve" area on the stack for this situation (it was 4096 bytes before, now it's 64k).

There also was a problem with garbage bits in character values for which the internal comparison routines didn't work correctly.

See "experimental" branch for the fix. The char-comparison change will only propagate by compiling the compiler with itself and then rebuilding.

comment:2 Changed 12 years ago by felix winkelmann


Milestone 4.7.0 deleted

comment:3 Changed 11 years ago by felix winkelmann


Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.