Use abort() in case of uncaught Error exceptions.
Fixes "dwarfeh(224) fatal error" that are suspected to be related to occasional infinite loops.
This commit is contained in:
parent
3d1175e821
commit
bfc6b89ca4
2 changed files with 11 additions and 17 deletions
|
@ -47,7 +47,7 @@ shared class TaskPool {
|
|||
threads.length = thread_count;
|
||||
foreach (i; 0 .. thread_count) {
|
||||
WorkerThread thr;
|
||||
() @trusted {
|
||||
() @trusted {
|
||||
thr = new WorkerThread(this);
|
||||
thr.name = format("vibe-%s", i);
|
||||
thr.start();
|
||||
|
@ -237,7 +237,7 @@ private class WorkerThread : Thread {
|
|||
|
||||
private void main()
|
||||
nothrow {
|
||||
import core.stdc.stdlib : exit;
|
||||
import core.stdc.stdlib : abort;
|
||||
import core.exception : InvalidMemoryOperationError;
|
||||
import std.encoding : sanitize;
|
||||
|
||||
|
@ -249,19 +249,13 @@ private class WorkerThread : Thread {
|
|||
if (!m_pool.m_state.lock.term) runEventLoop();
|
||||
logDebug("Worker thread exit.");
|
||||
} catch (Exception e) {
|
||||
scope (failure) exit(-1);
|
||||
scope (failure) abort();
|
||||
logFatal("Worker thread terminated due to uncaught exception: %s", e.msg);
|
||||
logDebug("Full error: %s", e.toString().sanitize());
|
||||
} catch (InvalidMemoryOperationError e) {
|
||||
import std.stdio;
|
||||
scope(failure) assert(false);
|
||||
writeln("Error message: ", e.msg);
|
||||
writeln("Full error: ", e.toString().sanitize());
|
||||
exit(-1);
|
||||
} catch (Throwable th) {
|
||||
logFatal("Worker thread terminated due to uncaught error: %s", th.msg);
|
||||
logDebug("Full error: %s", th.toString().sanitize());
|
||||
exit(-1);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,7 +332,7 @@ nothrow @safe:
|
|||
bool consume(ref TaskFuncInfo tfi)
|
||||
{
|
||||
import std.algorithm.mutation : swap;
|
||||
|
||||
|
||||
if (m_queue.empty) return false;
|
||||
swap(tfi, m_queue.front);
|
||||
m_queue.popFront();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue