[Issue 22743] New: core.thread.threadbase.ThreadError at src/core/thread/threadbase.d(1217): Error creating thread
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 6 13:06:01 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22743
Issue ID: 22743
Summary: core.thread.threadbase.ThreadError at src/core/thread/thr
eadbase.d(1217): Error creating thread
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: noizeless.vril at ctemplar.com
Hi folks, thanks a lot for D language.
I need create hightload multithread application, so, I had create a simple test
code to verify how much the D could give performance and met a strange error:
// Error output:
// ...
// destructed: 32631
// destructed: 32632
// core.thread.threadbase.ThreadError at src/core/thread/threadbase.d(1217): Error
creating thread
The application stopped with same error at the same point always. Also while
the app is running I see how fast memory consumption grows to 400Mb and then
crashed. At the same time a GC works well because messages about threads
destruction are printed.
I have did similar performance test on JDK 17 and got stable memory consumption
about 60Mb max.
module test.thread;
import std.stdio;
import core.thread.osthread;
import core.time;
void main() { massThreadTest(); }
private shared Duration dur1ms = dur!("msecs")(1);
private class LogThread : Thread {
private static shared int destructed;
this(void function() fn, size_t sz = 0) { super(fn, sz); }
this(void delegate() dg, size_t sz = 0 ){ super(dg, sz); }
~this() {
destructed = destructed + 1;
writeln("destructed: ", destructed);
}
}
private void massThreadTest() {
writeln("Start");
const int count = 1_000_000;
foreach(int i; 1..count) {
new LogThread(&run).start();
//write(i);write(' ');
Thread.sleep(dur1ms);
}
writeln("End");
}
private void run() {}
--
More information about the Digitalmars-d-bugs
mailing list