mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
Troubleshooting Embargo / EmbargoServer TC
This commit is contained in:
parent
44fd4edfe9
commit
fecfa94433
@ -774,6 +774,7 @@ namespace Capnp.Net.Runtime.Tests
|
||||
|
||||
var cap = new TestCallOrderImpl();
|
||||
cap.CountToDispose = 6;
|
||||
Skeleton.BeginAssertNotDisposed(cap);
|
||||
var earlyCall = main.GetCallSequence(0, default);
|
||||
|
||||
var echo = main.Echo(cap, default);
|
||||
@ -807,6 +808,8 @@ namespace Capnp.Net.Runtime.Tests
|
||||
Assert.AreEqual(3u, call3.Result);
|
||||
Assert.AreEqual(4u, call4.Result);
|
||||
Assert.AreEqual(5u, call5.Result);
|
||||
|
||||
Skeleton.EndAssertNotDisposed(cap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ namespace Capnp.Rpc
|
||||
{
|
||||
_question = question ?? throw new ArgumentNullException(nameof(question));
|
||||
_access = access ?? throw new ArgumentNullException(nameof(access));
|
||||
|
||||
_ = AwaitWhenResolved();
|
||||
}
|
||||
|
||||
async void ReAllowFinishWhenDone(Task task)
|
||||
@ -57,21 +59,24 @@ namespace Capnp.Rpc
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_resolvedCap == null && !_question.IsTailCall && _question.IsReturned)
|
||||
lock (_question.ReentrancyBlocker)
|
||||
{
|
||||
DeserializerState result;
|
||||
try
|
||||
if (_resolvedCap == null && !_question.IsTailCall && _question.IsReturned)
|
||||
{
|
||||
result = _question.WhenReturned.Result;
|
||||
}
|
||||
catch (AggregateException exception)
|
||||
{
|
||||
throw exception.InnerException;
|
||||
}
|
||||
DeserializerState result;
|
||||
try
|
||||
{
|
||||
result = _question.WhenReturned.Result;
|
||||
}
|
||||
catch (AggregateException exception)
|
||||
{
|
||||
throw exception.InnerException;
|
||||
}
|
||||
|
||||
_resolvedCap = new Proxy(_access.Eval(result));
|
||||
_resolvedCap = new Proxy(_access.Eval(result));
|
||||
}
|
||||
return _resolvedCap;
|
||||
}
|
||||
return _resolvedCap;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -973,7 +973,7 @@ namespace Capnp.Rpc
|
||||
|
||||
void ReleaseExport(uint id, uint count)
|
||||
{
|
||||
bool exists, badrc = false;
|
||||
bool exists;
|
||||
|
||||
lock (_reentrancyBlocker)
|
||||
{
|
||||
@ -993,9 +993,9 @@ namespace Capnp.Rpc
|
||||
_revExportTable.ReplacementTryRemove(rc.Cap, out uint _);
|
||||
}
|
||||
}
|
||||
catch (System.Exception)
|
||||
catch (System.Exception exception)
|
||||
{
|
||||
badrc = true;
|
||||
Logger.LogWarning($"Attempting to release capability with invalid reference count: {exception.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1004,10 +1004,6 @@ namespace Capnp.Rpc
|
||||
{
|
||||
Logger.LogWarning("Attempting to release unknown capability ID");
|
||||
}
|
||||
else if (badrc)
|
||||
{
|
||||
Logger.LogWarning("Attempting to release capability with invalid reference count");
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessRelease(Release.READER release)
|
||||
|
@ -29,9 +29,7 @@ namespace Capnp.Rpc
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
const int NoDisposeFlag = 0x4000000;
|
||||
#endif
|
||||
|
||||
static readonly ConditionalWeakTable<object, Skeleton> _implMap =
|
||||
new ConditionalWeakTable<object, Skeleton>();
|
||||
@ -63,7 +61,6 @@ namespace Capnp.Rpc
|
||||
return new SkeletonRelinquisher(GetOrCreateSkeleton(impl, true));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
/// <summary>
|
||||
/// This DEBUG-only diagnostic method states that the Skeleton corresponding to a given capability is not expected to
|
||||
/// be disposed until the next call to EndAssertNotDisposed().
|
||||
@ -84,7 +81,6 @@ namespace Capnp.Rpc
|
||||
{
|
||||
GetOrCreateSkeleton(impl, false).EndAssertNotDisposed();
|
||||
}
|
||||
#endif
|
||||
|
||||
int _refCount = 0;
|
||||
|
||||
@ -103,7 +99,6 @@ namespace Capnp.Rpc
|
||||
Interlocked.Increment(ref _refCount);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
internal void BeginAssertNotDisposed()
|
||||
{
|
||||
if ((Interlocked.Add(ref _refCount, NoDisposeFlag) & NoDisposeFlag) == 0)
|
||||
@ -118,7 +113,6 @@ namespace Capnp.Rpc
|
||||
throw new InvalidOperationException("Flag already cleared. State is now broken.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal void Relinquish()
|
||||
{
|
||||
@ -126,9 +120,8 @@ namespace Capnp.Rpc
|
||||
|
||||
if (0 == count)
|
||||
{
|
||||
#if DEBUG
|
||||
Debug.Assert((_refCount & NoDisposeFlag) == 0, "Skeleton disposal not expected in this state");
|
||||
#endif
|
||||
if ((count & NoDisposeFlag) != 0)
|
||||
throw new InvalidOperationException("Unexpected Skeleton disposal");
|
||||
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user