Opened 13 years ago

Closed 13 years ago

Last modified 12 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:

Description

$ /home/sjamaan/chicken-test/bin/csi -s run.scm
00000000
e8b7be43
352441c2
4c2750bd
1fc2e6d2
7ca94a72
d41d8cd98f00b204e9800998ecf8427e
0cc175b9c0f1b6a831c399e269772661
900150983cd24fb0d6963f7d28e17f72

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 13 years ago by felix winkelmann

Milestone: 4.7.04.8.0

Milestone 4.7.0 deleted

comment:3 Changed 12 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.