Skip to content
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

ORC runs into infinite recursion #22927

Closed
theamarin opened this issue Nov 10, 2023 · 9 comments
Closed

ORC runs into infinite recursion #22927

theamarin opened this issue Nov 10, 2023 · 9 comments

Comments

@theamarin
Copy link

theamarin commented Nov 10, 2023

Description

I can manage ORC to run into an apparently infinite recursion, which obviously should not happen.

Nim Version

The commit that breaks ORC for me is 71dc929.
It works with 02be212 but fails with 71dc929.

Current Output

[Suite] module
  [OK] attach_and_update
Traceback (most recent call last)
.../nim-lang/lib/system/iterators.nim(78) tests
.../nim-lang/lib/system.nim(910) newModule
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
(1874 calls omitted) ...
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(385) collectCycles
.../nim-lang/lib/system/orc.nim(340) collectCyclesBacon
.../nim-lang/lib/system/orc.nim(97) free
.../nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
.../nim-lang/lib/system/orc.nim(475) rememberCycle
.../nim-lang/lib/system/orc.nim(415) registerCycle
.../nim-lang/lib/system/orc.nim(375) collectCycles
.../nim-lang/lib/system/cellseqs_v2.nim(37) init
.../nim-lang/lib/system/alloc.nim(1052) alloc
.../nim-lang/lib/system/alloc.nim(895) rawAlloc
.../nim-lang/lib/system/alloc.nim(654) getBigChunk
.../nim-lang/lib/system/alloc.nim splitChunk
.../nim-lang/lib/system/alloc.nim(580) splitChunk2
.../nim-lang/lib/system/alloc.nim(563) updatePrevSize
.../nim-lang/lib/system/alloc.nim(528) isAccessible
.../nim-lang/lib/system/alloc.nim pageIndex
Error: call depth limit reached in a debug build (2000 function calls). You can change it with -d:nimCallDepthLimit=<int> but really try to avoid deep recursions instead.

Expected Output

[Suite] module
  [OK] attach_and_update
  [OK] attach_signal

Possible Solution

Revert or fix 71dc929

Additional Information

If I skip the test attach_and_update, the test attach_signal succeeds, so there obviously is a dependency on code that ran previously.
But this makes it unclear to me how to create a minimal failing example.

Any input is appreciated.

@ringabout
Copy link
Member

ringabout commented Nov 10, 2023

Well, you should figure out which type is wrongly classified by canFormAcycle. Might try add {.acyclic.} to some types. Not sure it's a false positive or the case.

There is a handy function, which can be used for this task:

proc isCyclic(t: typedesc): bool {.magic: "TypeTrait".} =
  ## Returns true if the type can potentially form a cyclic type

@theamarin
Copy link
Author

Hi @ringabout, thank you so much for your quick reply.
Actuall if I annotate an object type with {.acyclic.}, the ORC recursion disappears.
Also, the isCyclic() function returns true without the annotation and returns false when the type is annotated with {.acyclic.}.
But I am convinced that the type actually can be cyclic, which confuses me.
Here is the part of the type definition that might be of interest:

   MyNode* = ref object
      yaml*: YamlNode
      dependencies*: OrderedSet[MyNode]
      parent*: MyNode

      case kind*: NodeKind
      of cOne:
         discard
      of cOther:
         anotherReference*: MyNode

Different instances of MyNode may reference each other within dependencies or anotherReference, while parent should form an acyclic tree.

How to proceed? With your input, maybe I can manage to create a minimum failing example.

@ringabout
Copy link
Member

But I am convinced that the type actually can be cyclic, which confuses me.

Yeah, it seems that 71dc929 exposed a pre-existing issue, which means it was not a regression.

Did you use it in the multiple threads?

@theamarin
Copy link
Author

theamarin commented Nov 10, 2023

Did you use it in the multiple threads?

No, everything is single-threaded here.

I'm still working on a minimum breaking example.

@theamarin
Copy link
Author

theamarin commented Nov 10, 2023

Unfortunately, I did not manage to get the breaking example shorter than the following.

Also, you need to have yaml aka nimyaml installed, I tested it with the following versions:

So it may be that something inside nimyaml is breaking the ORC (@flyx), but even then I think ORC should not crash.

import yaml, yaml/dom

type
   YItem = object
      items {.defaultVal: @[].}: seq[YItem]
      entry: YEntry
      yaml {.transient.}: YamlNode

   YEntryKind = enum
      tkBasic
   YEntry = object
      case kind: YEntryKind
      of tkBasic: basicEntry: string
      yaml {.transient.}: YamlNode

   ZIdentifier = ref object
      item: ZItem
      parent: ZIdentifier

   ZItem = ref object
      y: YItem
      ids: ZIdentifier

func fillYamlNodes(obj: var YItem, y: YamlNode) =
   obj.yaml = y
   for i, x in obj.items.mpairs:
      fillYamlNodes(x, y["items"][i])
   obj.entry.yaml = y["entry"]

proc constructChild(s: var YamlStream, c: ConstructionContext, result: var YEntry) =
   var res: string
   constructChild(s, c, res)
   result = YEntry(kind: tkBasic, basicEntry: res)

proc newItem(y: YItem): ZItem =
   result = ZItem(y: y)
   result.ids = ZIdentifier(item: result)

proc myFunc() =
   var node: YamlNode
   load("""
entry: int
items:
  - entry: int
""", node)

   var stream = represent(node, tsAll, asNone)
   discard stream.next()

   var y: YItem
   construct(stream, y)
   y.fillYamlNodes(node)

   discard newItem(y)

var i = 0
while i < 100:
   echo $i
   myFunc()
   i.inc()

The output is as follows:

0
1
2
3
4
5
6
7
8
9
10
11
Traceback (most recent call last)
~/nim-lang/lib/std/assertions.nim(59) orcbreak
~/orcbreak/src/orcbreak.nim(41) myFunc
~/.nimble/pkgs2/yaml-1.1.0-69800cc68996ea75203b1d3aa706fb37909dada1/yaml/serialization.nim(1386) load
~/.nimble/pkgs2/yaml-1.1.0-69800cc68996ea75203b1d3aa706fb37909dada1/yaml/serialization.nim(1362) construct
~/nim-lang/lib/system.nim(910) constructChild
~/nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
~/nim-lang/lib/system/orc.nim(475) rememberCycle
~/nim-lang/lib/system/orc.nim(415) registerCycle
~/nim-lang/lib/system/orc.nim(385) collectCycles
~/nim-lang/lib/system/orc.nim(340) collectCyclesBacon
~/nim-lang/lib/system/orc.nim(97) free
~/nim-lang/lib/system/orc.nim(510) nimDecRefIsLastCyclicStatic
~/nim-lang/lib/system/orc.nim(475) rememberCycle
~/nim-lang/lib/system/orc.nim(415) registerCycle
~/nim-lang/lib/system/orc.nim(385) collectCycles
~/nim-lang/lib/system/orc.nim(340) collectCyclesBacon
~/nim-lang/lib/system/orc.nim(97) free
   (the last lines repeated)

Does this help you to reproduce the ORC failure?

@flyx
Copy link
Contributor

flyx commented Nov 10, 2023

This happens also with current NimYAML 2.0.0:

import yaml, yaml/dom

type
   YItem = object
      items {.defaultVal: @[].}: seq[YItem]
      entry: YEntry
      yaml {.transient.}: YamlNode

   YEntryKind = enum
      tkBasic
   YEntry = object
      case kind: YEntryKind
      of tkBasic: basicEntry: string
      yaml {.transient.}: YamlNode

   ZIdentifier = ref object
      item: ZItem
      parent: ZIdentifier

   ZItem = ref object
      y: YItem
      ids: ZIdentifier

func fillYamlNodes(obj: var YItem, y: YamlNode) =
   obj.yaml = y
   for i, x in obj.items.mpairs:
      fillYamlNodes(x, y["items"][i])
   obj.entry.yaml = y["entry"]

proc constructObject(
  ctx: var ConstructionContext,
  result: var YEntry
) =
   var res: string
   ctx.constructObject(res)
   result = YEntry(kind: tkBasic, basicEntry: res)

proc newItem(y: YItem): ZItem =
   result = ZItem(y: y)
   result.ids = ZIdentifier(item: result)

proc myFunc() =
   var node: YamlNode
   load("""
entry: int
items:
  - entry: int
""", node)

   var stream = represent(node)

   discard stream.next()

   var y: YItem
   construct(stream, y)
   y.fillYamlNodes(node)

   discard newItem(y)

var i = 0
while i < 100:
   echo $i
   myFunc()
   i.inc()

Similar output with slightly different stacktrace. What stands out is that the stack trace is wrong:

/nix/store/92w9kra6c4zj4fvp9qr0b6hm6lwbykp7-nim-unwrapped-2.0.0/nim/lib/system.nim(63) test1
/Users/flyx/Projects/NimYAML/test1.nim(44) myFunc
/Users/flyx/Projects/NimYAML/yaml/loading.nim(30) load
/Users/flyx/Projects/NimYAML/yaml/native.nim(1705) construct
/Users/flyx/Projects/NimYAML/yaml/dom.nim(938) constructChild
[… snip …]

dom.nim has fewer than 400 lines, 938 is a lie. In @theamarin 's stacktrace, that line is

~/nim-lang/lib/system.nim(910) constructChild

which is also wrong since constructChild is not defined in system.nim. So maybe that might be a hint to what's wrong?

There a a few lines in NimYAML specifically for ORC but they only concern some calls to shallowCopy (assignment is used instead if ORC is turned on) so I don't think these are the culprits. YamlNode is definitely a type that can contain cycles.

@ringabout
Copy link
Member

ringabout commented Nov 16, 2023

I'm looking into this issue

with -d:useMalloc

malloc(): unsorted double linked list corrupted
Segmentation fault (core dumped)

One of the valgrind errors

==14303== 209885 errors in context 166 of 167:
==14303== Invalid read of size 8
==14303==    at 0x11EC9B: eqtrace___OOZOOZhomeZcodespaceZOnimbleZpkgs50Zyaml4550O48O484553a55ef52aea5149ac52d5752f555453ea48ce5748485254dff53a56a5251ZyamlZdom_u627 (in /workspaces/Nim/test6)
==14303==    by 0x11ED5D: eqtrace___OOZOOZhomeZcodespaceZOnimbleZpkgs50Zyaml4550O48O484553a55ef52aea5149ac52d5752f555453ea48ce5748485254dff53a56a5251ZyamlZdom_u609 (in /workspaces/Nim/test6)
==14303==    by 0x10FD41: trace__system_u2884 (in /workspaces/Nim/test6)
==14303==    by 0x110A1A: collectColor__system_u3193 (in /workspaces/Nim/test6)
==14303==    by 0x1113DC: collectCyclesBacon__system_u3262 (in /workspaces/Nim/test6)
==14303==    by 0x11175E: collectCycles__system_u3403 (in /workspaces/Nim/test6)
==14303==    by 0x111B0E: registerCycle__system_u3428 (in /workspaces/Nim/test6)
==14303==    by 0x111C75: rememberCycle__system_u3468 (in /workspaces/Nim/test6)
==14303==    by 0x17EF37: nimDecRefIsLastCyclicStatic (in /workspaces/Nim/test6)
==14303==    by 0x17F0CF: eqdestroy___test54_u205 (in /workspaces/Nim/test6)
==14303==    by 0x180165: eqdestroy___test54_u416 (in /workspaces/Nim/test6)
==14303==    by 0x18031F: rttiDestroy__test54_u1634 (in /workspaces/Nim/test6)
==14303==  Address 0x4a73ac0 is 16 bytes inside a block of size 40 free'd
==14303==    at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==14303==    by 0x110BE3: deallocImpl__system_u1745 (in /workspaces/Nim/test6)
==14303==    by 0x110C02: deallocSharedImpl__system_u1758 (in /workspaces/Nim/test6)
==14303==    by 0x110C21: deallocShared (in /workspaces/Nim/test6)
==14303==    by 0x110C4B: alignedDealloc (in /workspaces/Nim/test6)
==14303==    by 0x110D79: nimRawDispose (in /workspaces/Nim/test6)
==14303==    by 0x110E9C: free__system_u2934 (in /workspaces/Nim/test6)
==14303==    by 0x1114E0: collectCyclesBacon__system_u3262 (in /workspaces/Nim/test6)
==14303==    by 0x11175E: collectCycles__system_u3403 (in /workspaces/Nim/test6)
==14303==    by 0x111B0E: registerCycle__system_u3428 (in /workspaces/Nim/test6)
==14303==    by 0x111C75: rememberCycle__system_u3468 (in /workspaces/Nim/test6)
==14303==    by 0x1745FB: nimDecRefIsLastCyclicStatic (in /workspaces/Nim/test6)
==14303==  Block was alloc'd at
==14303==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==14303==    by 0x115A3B: alloc0Impl__system_u1743 (in /workspaces/Nim/test6)
==14303==    by 0x115A61: allocShared0Impl__system_u1756 (in /workspaces/Nim/test6)
==14303==    by 0x115AA1: alignedAlloc0__system_u1927 (in /workspaces/Nim/test6)
==14303==    by 0x115DD7: nimNewObj (in /workspaces/Nim/test6)
==14303==    by 0x11F13E: newTable__OOZOOZhomeZcodespaceZOnimbleZpkgs50Zyaml4550O48O484553a55ef52aea5149ac52d5752f555453ea48ce5748485254dff53a56a5251ZyamlZdom_u4788 (in /workspaces/Nim/test6)
==14303==    by 0x17997A: constructChild__OOZOOZhomeZcodespaceZOnimbleZpkgs50Zyaml4550O48O484553a55ef52aea5149ac52d5752f555453ea48ce5748485254dff53a56a5251ZyamlZdom_u4781 (in /workspaces/Nim/test6)
==14303==    by 0x130E8F: construct__test54_u644 (in /workspaces/Nim/test6)
==14303==    by 0x1716C1: load__test54_u621 (in /workspaces/Nim/test6)
==14303==    by 0x180B03: myFunc__test54_u619 (in /workspaces/Nim/test6)
==14303==    by 0x180F49: NimMainModule (in /workspaces/Nim/test6)
==14303==    by 0x180E05: NimMainInner (in /workspaces/Nim/test6)

@theamarin
Copy link
Author

I can reproduce the valgrind errors, also with Nim 2.0.2, but I am still not able to debug the Nim internals.
Is there any progress on this?

@Araq
Copy link
Member

Araq commented Mar 8, 2024

I get:


==1081== Invalid read of size 8
==1081==    at 0x113A54: system::markGray(ptr<system::RefHeader>, ptr<system::TNimTypeV2>, var<system::GcEnv>) (@mlib@ssystem.nim.c:1129)
==1081==    by 0x112575: system::collectCyclesBacon(var<system::GcEnv>, int) (@mlib@ssystem.nim.c:1427)
==1081==    by 0x112B70: system::collectCycles (@mlib@ssystem.nim.c:1529)
==1081==    by 0x113028: system::registerCycle(ptr<system::RefHeader>, ptr<system::TNimTypeV2>) (@mlib@ssystem.nim.c:1600)
==1081==    by 0x113113: system::rememberCycle(bool, ptr<system::RefHeader>, ptr<system::TNimTypeV2>) (@mlib@ssystem.nim.c:1631)
==1081==    by 0x18AAE2: nimDecRefIsLastCyclicStatic (@mtemp2.nim.c:379)
==1081==    by 0x18AAE2: YItem::eqdestroy_(seq<temp2::YItem>) (@mtemp2.nim.c:411)
==1081==    by 0x18CA85: ZItem::eqdestroy_(var<temp2::ZItemcolonObjectType_>) (@mtemp2.nim.c:731)
==1081==    by 0x18D194: ZItem::rttiDestroy(pointer) (@mtemp2.nim.c:777)
==1081==    by 0x112900: _ZN6system4freeE3ptrIN6system9RefHeaderEE3ptrIN6system10TNimTypeV2EE (@mlib@ssystem.nim.c:1386)
==1081==    by 0x112900: system::collectCyclesBacon(var<system::GcEnv>, int) (@mlib@ssystem.nim.c:1496)
==1081==    by 0x112B70: system::collectCycles (@mlib@ssystem.nim.c:1529)
==1081==    by 0x113028: system::registerCycle(ptr<system::RefHeader>, ptr<system::TNimTypeV2>) (@mlib@ssystem.nim.c:1600)
==1081==    by 0x113113: system::rememberCycle(bool, ptr<system::RefHeader>, ptr<system::TNimTypeV2>) (@mlib@ssystem.nim.c:1631)
==1081==  Address 0x4a97a10 is 0 bytes inside a block of size 96 free'd
==1081==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1081==    by 0x111663: system::deallocImpl(pointer) (@mlib@ssystem.nim.c:1337)
==1081==    by 0x111675: system::deallocSharedImpl(pointer) (@mlib@ssystem.nim.c:1340)
==1081==    by 0x111687: deallocShared (@mlib@ssystem.nim.c:1343)
==1081==    by 0x111DF0: alignedDealloc (@mlib@ssystem.nim.c:1348)
==1081==    by 0x1149B5: nimRawDispose (@mlib@ssystem.nim.c:1372)
==1081==    by 0x112921: _ZN6system4freeE3ptrIN6system9RefHeaderEE3ptrIN6system10TNimTypeV2EE (@mlib@ssystem.nim.c:1390)
==1081==    by 0x112921: system::collectCyclesBacon(var<system::GcEnv>, int) (@mlib@ssystem.nim.c:1496)
==1081==    by 0x112B70: system::collectCycles (@mlib@ssystem.nim.c:1529)
==1081==    by 0x113028: system::registerCycle(ptr<system::RefHeader>, ptr<system::TNimTypeV2>) (@mlib@ssystem.nim.c:1600)
==1081==    by 0x113113: system::rememberCycle(bool, ptr<system::RefHeader>, ptr<system::TNimTypeV2>) (@mlib@ssystem.nim.c:1631)
==1081==    by 0x18148A: nimDecRefIsLastCyclicStatic (@m..@s..@s..@s..@s..@s..@shome@saraq@s.nimble@spkgs@syaml-2.1.1@syaml@sdom.nim.c:721)
==1081==    by 0x18148A: dom::eqdestroy_(ref<dom::YamlNodeObj>) (@m..@s..@s..@s..@s..@s..@shome@saraq@s.nimble@spkgs@syaml-2.1.1@syaml@sdom.nim.c:1048)
==1081==    by 0x18629A: dom::constructChild(var<native::ConstructionContext>, var<ref<dom::YamlNodeObj> >) (@m..@s..@s..@s..@s..@s..@shome@saraq@s.nimble@spkgs@syaml-2.1.1@syaml@sdom.nim.c:2228)
==1081==  Block was alloc'd at
==1081==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1081==    by 0x11161B: system::allocImpl(range09223372036854775807) (@mlib@ssystem.nim.c:930)
==1081==    by 0x11162D: allocSharedImpl (@mlib@ssystem.nim.c:935)
==1081==    by 0x11666D: system::alignedAlloc(range09223372036854775807, range09223372036854775807) (@mlib@ssystem.nim.c:1696)
==1081==    by 0x11BEE2: nimNewObjUninit (@mlib@ssystem.nim.c:4239)
==1081==    by 0x18594E: dom::constructChild(var<native::ConstructionContext>, var<ref<dom::YamlNodeObj> >) (@m..@s..@s..@s..@s..@s..@shome@saraq@s.nimble@spkgs@syaml-2.1.1@syaml@sdom.nim.c:2048)
==1081==    by 0x136799: construct::construct(var<ref<stream::YamlStreamcolonObjectType_> >, var<ref<dom::YamlNodeObj> >) (@m..@s..@s..@s..@s..@s..@shome@saraq@s.nimble@spkgs@syaml-2.1.1@syaml@snative.nim.c:1260)
==1081==    by 0x17CC73: load::load(string, var<ref<dom::YamlNodeObj> >) (@m..@s..@s..@s..@s..@s..@shome@saraq@s.nimble@spkgs@syaml-2.1.1@syaml@sloading.nim.c:531)
==1081==    by 0x18DB05: temp2::myFunc (@mtemp2.nim.c:947)
==1081==    by 0x18DE64: NimMainModule (@mtemp2.nim.c:1042)
==1081==    by 0x18DF1D: NimMainInner (@mtemp2.nim.c:1003)
==1081==    by 0x18DF34: NimMain (@mtemp2.nim.c:1014)

@Araq Araq closed this as completed in 3770236 Jun 12, 2024
narimiran pushed a commit that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants