New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault + seemingly crazy memory gobbling #182
Comments
|
I'm not able to reproduce this segfault on master on x86_64/Ubuntu 11.10 with either an optimized or an unoptimized build. can you specify your platform? |
|
Which sha1/version and platform did this happen on? Can we get a backtrace? |
|
Happens with RELEASE_3_9_0. I've built with MSVC++ compiler, on Windows, 64-bit. Also, try increasing the number of iterations. 5000 is not enough to trigger it on my box, for example. |
|
Note that I also wasn't able to reproduce this segfault in pure PIR, but I could when doing the same in Rakudo. See https://rt.perl.org/rt3//Public/Bug/Display.html?id=101912 for the sample code. (64bit linux on RELEASE_3_9_0) |
|
Yes - I guess the extra bits of memory/GC activity in the Rakudo version bring out the issue. Note that it explodes in a different place in the Rakudo one than where I had this PIR version doing so. |
|
Can you reproduce the issue if you use something like a StringBuilder PMC instead of doing the raw string concats directly? Also, can you make the issue appear if you don't use the ByteBuffer PMC to setup the substrings? I'm trying to narrow down possible causes. I'll try to look at this one today. |
|
Having another look, I think that at least the segfault is specific to ByteBuffer. It keeps track of the strstart pointer, however it appears that this may actually change over the lifetime of the string. That seems to be what move_one_buffer in string_gc.c is doing. The segfaults all look like memory corruption of some sort, and trying to access a buffer that got moved would probably cause that. |
|
I've been able to reproduce it by adding 'sweep 1' to the loop. Yes, looks like ByteBuffer is depending in internal immutability of STRING, which has abandoned some time ago to allow some optimization in concat operations. Fix coming. |
|
Fixed for me in 65e6ab7, please verify. |
|
The good news: that ByteBuffer fix makes the Rakudo bug that was originally reported go away. :-) The bad news: Something is still not right. The PIR example I have gave still segfaults during string heap compaction. Here's a full stack trace. |
|
One more fix added in 393e5e7, it should avoid negative effects of heap compaction. The method get_chars is not fixed yet, and it probably has the same problem. It may be more complicated than the other cases because of the size in codepoints, I'm not sure about the correctness of partial_scan in corner cases, |
|
Tried it, but I still get the segfault in the same place with the original PIR program I posted. And it's swallowed 2.7 GB of RAM by then (very, very quickly, I should add). |
|
Can this snippet be written as a test to make it easy to, for On Wed, Oct 26, 2011 at 9:48 AM, Jonathan Worthington
Jonathan "Duke" Leto jonathan@leto.net |
|
@jnthn is this still a problem or can this issue be closed? |
|
I fail to segfault on OS X: Rev: 32ac823 |
|
Closing this issue, please create another or reopen if this is still a problem. |
This program reliably segfaults for me:
It does so in the function move_one_buffer in string_gc.c
Also rather worrying is that - even though the longest buffer string it should ever construct is 10000 * 100 bytes (and I guess it segfaults before it gets there) - at the point it segfaults it has eaten 2.7 GB of RAM!
The text was updated successfully, but these errors were encountered: