[darcs-devel] [issue2313] whatsnew -l: Stack space overflow

bf bugs at darcs.net
Tue May 28 21:06:20 UTC 2013


bf <benjamin.franksen at helmholtz-berlin.de> added the comment:

I found out it is not the file size alone (of the accidentally present
ioc3s1g.sumlog) that causes the stack overflow, but rather that the file
does not end in a newline! Adding a final '\n' makes the problem
disappear. Also shrinking the file size does:

> cp ~/tmp/head/ioc3s1g.sumlog .
> truncate ioc3s1g.sumlog --size=50M
> time darcs whatsnew -l            
Stack space overflow: current size 8388608 bytes.
Use `+RTS -Ksize -RTS' to increase it.
darcs whatsnew -l  6,70s user 0,35s system 99% cpu 7,061 total
> truncate ioc3s1g.sumlog --size=40M
> time darcs whatsnew -l            
Stack space overflow: current size 8388608 bytes.
Use `+RTS -Ksize -RTS' to increase it.
darcs whatsnew -l  5,08s user 0,32s system 99% cpu 5,406 total
> truncate ioc3s1g.sumlog --size=30M
> time darcs whatsnew -l            
Stack space overflow: current size 8388608 bytes.
Use `+RTS -Ksize -RTS' to increase it.
darcs whatsnew -l  3,89s user 0,24s system 99% cpu 4,141 total
> truncate ioc3s1g.sumlog --size=20M
> time darcs whatsnew -l            
a ./ioc3s1g.sumlog
darcs whatsnew -l  2,55s user 0,13s system 99% cpu 2,686 total
> truncate ioc3s1g.sumlog --size=15M
> time darcs whatsnew -l            
a ./ioc3s1g.sumlog
darcs whatsnew -l  1,88s user 0,16s system 99% cpu 2,048 total
> truncate ioc3s1g.sumlog --size=10M
> time darcs whatsnew -l            
a ./ioc3s1g.sumlog
darcs whatsnew -l  1,30s user 0,07s system 99% cpu 1,375 total
> truncate ioc3s1g.sumlog --size=1M 
> time darcs whatsnew -l           
a ./ioc3s1g.sumlog
darcs whatsnew -l  0,12s user 0,04s system 96% cpu 0,165 total

I have verified that each truncation leaves the file ending without a
newline. Note that even at sizes below 20M when Darcs properly
terminates, the performance is still bad (but gets better the smaller
the file is). Now, contrast this with leaving the file at its original
65M, only add a final newline:

> time darcs whatsnew -l
a ./ioc3s1g.sumlog
darcs whatsnew -l  0,07s user 0,07s system 97% cpu 0,139 total

This is much faster!

I hope these findings make it easier to pinpoint the bug in the code.

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue2313>
__________________________________


More information about the darcs-devel mailing list