I’ve been working on updating/enhancing the debugger concept code and I’ve run into a situation where a gc fatal report is generated. I’m not exactly sure what it’s trying to say, as I /think/ the data all makes sense (though I’m unclear what 2+0 internal refs vs 2 refs might mean.
The pike in question is based on master from quite a while ago. I tried merging current master (which itself was a surprisingly easy task), but pike fails to compile due to typechecker errors. I tried building straight from master, but the build similarly fails with --with-debug and without that, pike compiles but fails to start. I’m hoping that doesn’t prevent coming up with an explanation for the problem.
I believe the “thing” in question is the main program, which comes from a file called file.pike. I’ve created a breakpoint object( for a line in this program), which is a PIKECLASS defined in _Debug/debug.cmod. The breakpoint object /does/ hold a reference to the program containing the breakpoint, but at this point, the breakpoint object hasn’t been destroyed.
Can anyone detect a problem from this report?
Bill
---CUT HERE ---
/Users/hww3/pikedbg/src/gc.c:1938: GC fatal:
Thing is getting more internal refs (2 + 0) than refs (2).
(Could be an extra free somewhere, or a pointer might have been checked more than once.)
**Block: 0x10dd303f0 Type: program Refs: 2
**Got gc marker at 0x10dd303f0: flags=0x00002 refs=2 weak=0 xrefs=0 saved=2 frame=0x0
**Program id: 65669, flags: f, parent id: -1
**Location: /Users/hww3/pikedbg/file.pike:0
**Identifiers:
** 0 fun: name: main addr: 0x24
** 1 fun: use name: f addr: 0x360
*******************
**Looking for references to 0x10dd303f0:
***One ref found as mapping index. -> from mapping 0x7faf328004d0 offset -8362904
**In index program(/Users/hww3/pikedbg/file.pike)
**Block: 0x7faf328004d0 Type: mapping Refs: 1
Refs=1, next=0x7faf32800490, prev=0x7faf32800510, flags=0x0, size=33, hashsize=16
Indices type field = program
Values type field = string
([ /* 33 elements */
master: "/master",
object_program(Getopt): "/Users/hww3/pikedbg/lib/modules/Getopt.pmod",
/main: "/main",
object_program(Debug): "/Users/hww3/pikedbg/lib/modules/Debug.pmod/module.pmod",
object_program(Debug.Debugger): "/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/module.pmod",
Debug.Debugger.Breakpoint: "/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/Breakpoint.pike",
Debug.Debugger.DebugServer: "/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/DebugServer.pike",
object_program(Debug.Debugger.DebugAdapterProtocol): "/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/DebugAdapterProtocol.pmod",
- - - trimmed for brevity
])
*******************
----------end------------
***One ref found as mapping value. -> from mapping 0x7faf328003d0 offset 537720
**In value with index "/main"
**Block: 0x7faf328003d0 Type: mapping Refs: 1
Refs=1, next=0x7faf32800290, prev=0x7faf32800350, flags=0x0, size=33, hashsize=16
Indices type field = string
Values type field = program
([ /* 33 elements */
"/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/Breakpoint.pike": Debug.Debugger.Breakpoint,
"/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/DebugAdapterProtocol.pmod": object_program(Debug.Debugger.DebugAdapterProtocol),
"/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/DebugServer.pike": Debug.Debugger.DebugServer,
"/Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/module.pmod": object_program(Debug.Debugger),
"/Users/hww3/pikedbg/lib/modules/Debug.pmod/module.pmod": object_program(Debug),
"/Users/hww3/pikedbg/lib/modules/Pike.pmod/module.pmod": object_program(Pike),
- - - trimmed for brevity
"/main": /main,
"/master": master
])
*******************
----------end------------
***One ref found. -> from object 0x7faf3286eaa0 offset 10033200
**In storage for inherit 0
**In variable prog
**In storage for inherit 1 (debug_breakpoint)
**Block: 0x7faf3286eaa0 Type: object Refs: 1
**Got gc marker at 0x7faf3286eaa0: flags=0x00002 refs=1 weak=0 xrefs=0 saved=1 frame=0x0
**Program id: 65699
**Object variables:
** === In inherit "debug_breakpoint", program 65626:
** rtt: program name: prog off: 0 value: program(/Users/hww3/pikedbg/file.pike)
** rtt: string name: programs_fname off: 8 value: "/Users/hww3/pikedbg/file.pike"
** rtt: string name: real_path off: 16 value: "/Users/hww3/pikedbg/file.pike"
** rtt: string name: within_fname off: 24 value: "/Users/hww3/pikedbg/file.pike"
** rtt: int name: line_number off: 32 value: 18
** rtt: int name: enabled off: 40 value: 1
** rtt: int name: want_enabled off: 48 value: 0
**Describing program 0x10dd33000 of object:
**Got gc marker at 0x10dd33000: flags=0x00002 refs=4 weak=0 xrefs=0 saved=4 frame=0x0
**Program id: 65699, flags: 202f, parent id: -1
**The program was written in C.
**Location: /Users/hww3/pikedbg/lib/modules/Debug.pmod/Debugger.pmod/Breakpoint.pike:0
**There is no parent (any longer?)
*******************
----------end------------
***One ref found as the program of an object.
**Block: 0x7faf3286ea50 Type: object Refs: 5
**Program id: 65669
**Object variables:
** (none)
**Describing program 0x10dd303f0 of object:
**Got gc marker at 0x10dd303f0: flags=0x00002 refs=2 weak=0 xrefs=0 saved=2 frame=0x0
**Program id: 65669, flags: f, parent id: -1
**Location: /Users/hww3/pikedbg/file.pike:0
**There is no parent (any longer?)
*******************
----------end------------
***One ref found in current_program in frame on stack.
**Block: 0x7faf32821b38 Type: pike_frame Refs: 1
**Function f at /Users/hww3/pikedbg/file.pike:14
*******************
----------end------------
***One ref found in current_program in frame on stack.
**Block: 0x7faf32821aa0 Type: pike_frame Refs: 1
**Function main at /Users/hww3/pikedbg/file.pike:2
*******************
----------end------------
***One ref found on svalue stack. -> from pike_frame 0x7faf32821a08 offset -140385920272696
**At position 12 among locals
**Block: 0x7faf32821a08 Type: pike_frame Refs: 1
**Function _main at /Users/hww3/pikedbg/build/darwin-18.7.0-x86_64/master.pike:4069
*******************
----------end------------
**Done looking for references to 0x10dd303f0, found 7 refs.
Pike was in GC stage 100 when this fatal occurred.
Backtrace at time of fatal:
src/modules/_Debug/debug.cmod:652: lib/modules/Debug.pmod/Debugger.pmod/Breakpoint.pike()
-:1:
Stdio.FILE(2, "w", 777 /* fd=2 */)->write("\nSending response: \nContent-Length: 228\r\n\r\n{\"request_seq\":16,\"seq\":0,\"body\":{\"threads\":[{\"name\":\"Thread.Thread(4541273536)\",\"id\":4541273536},{\"nam"+[80]+"\"message\":null,\"success\":1,\"type\":\"response\"}\n")
lib/modules/Stdio.pmod/module.pmod:1105:
Stdio.FILE(2, "w", 777 /* fd=2 */)->write("\nSending response: \nContent-Length: 228\r\n\r\n{\"request_seq\":16,\"seq\":0,\"body\":{\"threads\":[{\"name\":\"Thread.Thread(4541273536)\",\"id\":4541273536},{\"nam"+[80]+"\"message\":null,\"success\":1,\"type\":\"response\"}\n")
lib/modules/Stdio.pmod/module.pmod:2239:
Stdio.FILE(2, "w", 777 /* fd=2 */)->write("\nSending response: \nContent-Length: 228\r\n\r\n{\"request_seq\":16,\"seq\":0,\"b"+[180]+"1,\"type\":\"response\"}\n","Content-Length: 228\r\n\r\n{\"request_seq\":16,\"seq\":0,\"body\":{\"threads\":[{\"n"+[159]+":1,\"type\":\"response\"}")
build/darwin-18.7.0-x86_64/master.pike:6576:
werror("\nSending response: \n%s\n","Content-Length: 228\r\n\r\n{\"request_seq\":16,\"seq\":0,\"body\":{\"threads\":[{\"name\":\"Thread.Thread(4541273536)\",\"id\":4541273536},{\"na"+[87]+"ge\":null,\"success\":1,\"type\":\"response\"}")
lib/modules/Debug.pmod/Debugger.pmod/DebugServer.pike:31: Debug.Debugger.DebugServer()->write_response(Debug.Debugger.DebugAdapterProtocol.ThreadsResponse())
lib/modules/Debug.pmod/Debugger.pmod/DebugServer.pike:145: Debug.Debugger.DebugServer()->handle_threads_request(mapping[3])
lib/modules/Debug.pmod/Debugger.pmod/DebugServer.pike:678:
Debug.Debugger.DebugServer()->breakpoint_read(Stdio.File("socket", "127.0.0.1 51892", 777 /* fd=10 */),"Content-Length: 47\r\n\r\n{\"command\":\"threads\",\"type\":\"request\",\"seq\":16}")
lib/modules/Stdio.pmod/module.pmod:1165: Stdio.File("socket", "127.0.0.1 51892", 777 /* fd=10 */)->__stdio_read_callback()
-:1: Pike.Backend(1)->`()(1000.0)
lib/modules/Debug.pmod/Debugger.pmod/DebugServer.pike:540: Debug.Debugger.DebugServer()->__lambda_65700_0_line_540()
Abort trap: 6