-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes ByteBuffer+Stream integration, TLS neg, STEE Shutdown #91
Conversation
1c3e871
to
a8f5e7c
Compare
@@ -120,6 +119,14 @@ public override void Execute(IRunnable task) | |||
} | |||
} | |||
|
|||
protected void WakeUp(bool inEventLoop) | |||
{ | |||
if (!inEventLoop || this.executionState == ST_SHUTTING_DOWN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to if (!inEventLoop || IsShuttingDown)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's difference between IsShuttingDown
is >=
and WakeUp
uses ==
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, right. guess there's no point in waking up after we've terminated.
Seeing debug assertions get thrown for this spec in ReSharper as a result of this change: public class SingleThreadEventExecutorSpecs
{
public static AtomicCounter ThreadNameCounter { get; } = new AtomicCounter(0);
[Fact]
public void STE_should_complete_task_when_operation_is_completed()
{
using (
var executor = new SingleThreadEventExecutor("Foo" + ThreadNameCounter.GetAndIncrement(),
TimeSpan.FromMilliseconds(100)))
{
Func<bool> myFunc = () => true;
var task = executor.SubmitAsync(myFunc);
Assert.True(task.Wait(200), "Should have completed task in under 200 milliseconds");
Assert.True(task.Result);
executor.GracefulShutdownAsync();
}
}
} |
InEventLoop == false during |
That doesn't make sense... |
I'm in agreement with you - I'll try to replicate this issue with the normal XUnit runner; so far I've only seen it happen in ReSharper. |
heh, just realized what it might be - think there could be an issue with the |
Since I'm not blocking on the |
makes sense |
Not sure if it even makes sense to have it implement IDisposable |
at the very least, have the |
no, that's just misleading.. |
I think I introduced impl of |
Funny part is, it didn't even implement |
I'm removing Dispose, will post a new version in a sec. |
Motivation: Fix up top priority issues to ensure proper working state with recent changes. Modifications: - TlsHandler negotiates TLS 1.0+ on server side (Azure#89) - STEE properly supports graceful shutdown (Azure#7) - UnpooledHeapByteBuffer.GetBytes honors received index and length (Azure#88) - Echo E2E test uses length-prefix based framing (Azure#90) Result: Setting up DotNetty does not require workarounds for shutdown and hacks to enable negotiation of higher versions of TLS. Tests are passing even with new SslStream behavior.
I don't agree with that - I'd expect the result of the call to be that the object is finalized and ready for garbage collection when the method exits. |
👍 |
Dispose is meant for lightweight teardown though. Blocking call that might not return in 5 seconds (default shutdown timeout) might result in confusion. Better have a clear non-standard way of doing shutdown for now. Once IAsyncDisposable comes around, we'll support that as it sets right expectations and allows for non-blocking signaling of shutdown completion. |
Yeah, that's true - if the teardown takes sufficiently long that would be undesirable too. I agree with what you've done here. |
LGTM |
Motivation:
Fix up top priority issues to ensure proper working state with recent changes.
Modifications:
Result:
Setting up DotNetty does not require workarounds for shutdown and hacks to enable negotiation of higher versions of TLS. Tests are passing even with new SslStream behavior.