Skip to content

Commit b92f473

Browse files
committed
Add [HandleProcessCorruptedStateExceptions] attribute to the event loop
- needed so that we can catch AccessViolationExceptions and terminate the process
1 parent 2d426e9 commit b92f473

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

FoundationDB.Client/Fdb.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace FoundationDB.Client
3636
using System;
3737
using System.Diagnostics;
3838
using System.Runtime.CompilerServices;
39+
using System.Runtime.ExceptionServices;
3940
using System.Threading;
4041
using System.Threading.Tasks;
4142
using SystemIO = System.IO;
@@ -307,6 +308,7 @@ private static void StopEventLoop()
307308
}
308309

309310
/// <summary>Entry point for the Network Thread</summary>
311+
[HandleProcessCorruptedStateExceptions]
310312
private static void EventLoop()
311313
{
312314
//TODO: we need to move the crash handling logic outside this method, so that an app can hook up an event and device what to do: crash or keep running (dangerous!).

FoundationDB.Client/FdbFutureSingle.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,14 @@ protected override void CloseHandles()
252252
protected override void CancelHandles()
253253
{
254254
var handle = m_handle;
255-
//REVIEW: there is a possibility of a race condition with Dispoe() that could potentially call FutureDestroy(handle) at the same time (not verified)
255+
//REVIEW: there is a possibility of a race condition with Dispose() that could potentially call FutureDestroy(handle) at the same time (not verified)
256256
if (handle != null && !handle.IsClosed && !handle.IsInvalid) FdbNative.FutureCancel(handle);
257257
}
258258

259259
protected override void ReleaseMemory()
260260
{
261261
var handle = m_handle;
262-
//REVIEW: there is a possibility of a race condition with Dispoe() that could potentially call FutureDestroy(handle) at the same time (not verified)
262+
//REVIEW: there is a possibility of a race condition with Dispose() that could potentially call FutureDestroy(handle) at the same time (not verified)
263263
if (handle != null && !handle.IsClosed && !handle.IsInvalid) FdbNative.FutureReleaseMemory(handle);
264264
}
265265

0 commit comments

Comments
 (0)