#GC Bug?

1 messages · Page 1 of 1 (latest)

hot badger
#

made a much smaller example

#
import std.stdio;
int main() {

  bool allocate = true;
  int count = 50;
  while (true) {
    if(allocate && count > 0) {
      ubyte[] block_of_data = new ubyte[100_000];
      stderr.writeln(count);
      count--;
    }
  }
  return 0;
}
tribal relic
#

so an infinite loop infinitely loops?

hot badger
hot badger
tribal relic
#

so if you did like

else {
  import core.thread;
   Thread.sleep(1.seconds);
}

after the if(allocate) thing do you still see 100%

tribal relic
#

ok interesting cuz that should take your main thread out of the running

hot badger
#

#programming message

#

this is where I was discussing it before. I was trying to clean it up so I could discuss it in one place now I just made a mess and I am discussing it in two places

but yeah its 100% across all threads

#

disabling the GC does cause it to stop

tribal relic
#

yeah it must be some like semaphore breakage in he thred. you test on linux too or only on windows?

hot badger
#

latest version of the compiler for dmd and ldc

#
LDC - the LLVM D compiler (1.42.0):
  based on DMD v2.112.1 and LLVM 21.1.8
  built with LDC - the LLVM D compiler (1.42.0)
DMD 
D Compiler v2.112.0
tribal relic
#

yeah i can reproduce w/ upstream dmd

bug absent in opend

#

definitely a druntime regression then

#

i don't even have upstream dmd on my personal computer so i tested on the work computer lol but this kind of thing prolly affects day job company too

hot badger
#

so yeah a fairly large issue

tribal relic
#

aye, it seems unbelievale to me they'd ship something so obviously broken

#

i'd notice this kind of thing instantly cuz i use my D programs all day every day and i'd hear my cpu fan spinning lol

#

i did not see the problem on WSL with same dmd version.

#

me@arsd:~/d/pull-request-stuff/dmd/druntime/src$ git show 14eed8d825a
me@arsd:~/d/pull-request-stuff/dmd/druntime/src$ git blame ./core/internal/gc/impl/conservative/gc.d
me@arsd:~/d/pull-request-stuff/dmd/druntime/src$ git show f90bf149c36

#

i haven't proven those commits are the problem but they're recent changes to the part of the code that would be hit in a loop like this, and the event and/or stop flags being wrong would explain an infinite loop like this

#

that isn't system specific but the implementation of Event varies between windows and posix so that's likely i would say where this went wrong

gloomy wraith
#

looks like the testsuite is terribly lacking

#

This flood of regressions looks worse than the Phobos regression witch hunt from 2025 — that targeted me and PRs from the salvaging queue.

tribal relic
#

just tested day job program too and it uses the newer gc and doesn't seem tobe affected sooooooooooo this is prolly where i stop cuz if they're not affected i can't really spin it as work-related to hunt down lol

and opend of course isn't affected cuz we don't pull regressions every other day

but still if someone wanted to pick it up from those commits i betcha you'd find the source soon enough

#

the author of those commits btw usually does good work and is i think a windows user; he maintains the visual-d thing. so might not be that specifically since he'd be mroe likely to catch sucha problem but still check it out

tribal relic