From: Vladimir T. <vtz...@gm...> - 2017-05-27 18:20:24
|
Hi Bruno, On Sat, May 27, 2017 at 12:14 AM, Vladimir Tzankov <vtz...@gm...> wrote: > There was no GC run since the startup (double checked it) so it should not >> be GC safety issue. >> > > Actually I was wrong in my double checking :(. > This happens after the first GC. Would classify it as GC safety issue now. > I see you've added OLD_GC to revert to pre-MT GC. While adding MT stuff I tried hard to keep everything "as is" in single thread builds. Back to the issue - I experience the same problem with OLD_GC enabled. After adding some debug logging (see the diff below) I observe strm_encoding of the stream object is not getting updated during the GC. This is SINGLEMAP_MEMORY with OLD_GC. vtz@debian:~/clisp/src$ hg diff . diff -r d573e8e54c34 src/spvw_garcol_old.d --- a/src/spvw_garcol_old.d Fri May 26 19:24:49 2017 +0200 +++ b/src/spvw_garcol_old.d Thu May 25 06:00:37 2017 +0300 @@ -1493,6 +1493,7 @@ /* perform normal Garbage Collection: */ local void gar_col_normal (void) { + printf("PERFORM GC: %d\n", gc_count); var uintM gcstart_space; /* occupied memory at GC-start */ var uintM gcend_space; /* occupied memory at GC-end */ var object all_weakpointers; /* list of active Weak-pointers */ diff -r d573e8e54c34 src/stream.d --- a/src/stream.d Fri May 26 19:24:49 2017 +0200 +++ b/src/stream.d Thu May 25 06:00:37 2017 +0300 @@ -6651,8 +6651,10 @@ var uintL available = endvalid - BufferedStream_index(stream); var const uintB* bptr = bufferptr; var chart* cptr = &c; + printf("BEFORE: STREAM: %p, ENCODING: %p\n", stream, encoding); Encoding_mbstowcs(encoding) (encoding,stream,&bptr,bufferptr+available,&cptr,&c+1); + printf("AFTER: STREAM: %p, ENCODING: %p\n", stream, encoding); if (cptr == &c+1) { var uintL n = bptr-bufferptr; /* increment index and position */ And here is the output in gdb: [1]> (describe nil) ... BEFORE: STREAM: 0xb0000005ac0, ENCODING: 0xc000001a280 AFTER: STREAM: 0xb0000005ac0, ENCODING: 0xc000001a280 ... /* VTZ: plenty of the above */ BEFORE: STREAM: 0xb0000005ac0, ENCODING: 0xc000001a280 AFTER: STREAM: 0xb0000005ac0, ENCODING: 0xc000001a280 PERFORM GC: 0 /*VTZ: first GC run */ BEFORE: STREAM: 0xb0000001780, ENCODING: 0xc000001a280 *** - handle_fault error2 ! address = 0xc000001a2b8 not in [0xc0000000000,0xc00000179f0) ! Breakpoint 1, sigsegv_handler_failed (address=address@entry=0xc000001a2b8) at ../src/spvw_sigsegv.d:64 64 fputc('\n',stderr); (gdb) p /x mem.heaps[0x0b] $1 = {pages = {start = 0xb0000000000, end = 0xb0000001a60, gcpriv = {firstmarked = 0xb0000001000, l = 0xb0000001000, d = 0xb0000001000, next = 0xb0000001000}}, heap_limit = 0xb0000002000, heap_hardlimit = 0xc0000000000, heap_gen0_start = 0xb0000000000, heap_gen0_end = 0xb0000000d80, heap_gen1_start = 0xb0000001000, physpages = 0x83aff0} (gdb) p /x mem.heaps[0x0c] $2 = {pages = {start = 0xc0000000000, end = 0xc00000183a8, gcpriv = {firstmarked = 0xc0000018000, l = 0xc0000018000, d = 0xc0000018000, next = 0xc0000018000}}, heap_limit = 0xc0000019000, heap_hardlimit = 0xd0000000000, heap_gen0_start = 0xc0000000000, heap_gen0_end = 0xc00000179f0, heap_gen1_start = 0xc0000018000, physpages = 0x83ca10} The stream object has been moved due to compaction but strm_encoding has either not moved (unlikely - its heap has shrunk) or has not been updated. |