Skip to content
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

Introduce LocalRestConnectionClosed exception #117

Open
wants to merge 1 commit into
base: v0.x.x
Choose a base branch
from

Conversation

AndrejMitrovic
Copy link
Contributor

This will allow as to at least handle node shutdowns gracefully when using LocalRest in our test-suite. At least it should fix crashes in the tests involving periodic timers.

@codecov
Copy link

codecov bot commented Mar 11, 2021

Codecov Report

Merging #117 (3da4383) into v0.x.x (aa890bd) will increase coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           v0.x.x     #117      +/-   ##
==========================================
+ Coverage   96.25%   96.31%   +0.06%     
==========================================
  Files           5        5              
  Lines        1255     1276      +21     
==========================================
+ Hits         1208     1229      +21     
  Misses         47       47              
Flag Coverage Δ
unittests 96.31% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
source/geod24/LocalRest.d 95.72% <100.00%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa890bd...3da4383. Read the comment docs.

@AndrejMitrovic
Copy link
Contributor Author

I just realized I can catch it in the Timer routine itself. One second..

@AndrejMitrovic
Copy link
Contributor Author

I made it better now. The setTimer will automatically handle the exception if it escapes the delegate. That way we won't have to touch any of the Agora code.

This allows tests to gracefully handle
peer nodes shutting down.
Copy link

@hewison-chris hewison-chris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


size_t count; // up to 3 seconds wait
while (!atomicLoad(connection_closed))
assert(count < 300); count++; Thread.sleep(10.msecs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this doesnt need curly braces? D is a weird language.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know what happened? The stupid coverage bot failed my PR because 3 lines weren't covered. So I put them all on the same line. And then I removed the braces. I need sleep.

@Geod24
Copy link
Owner

Geod24 commented Mar 11, 2021

So, is this an issue with client code, or LocalRest ? I'm quite wary of introducing Exceptions that can be handled for specific LocalRest situation.

@omerfirmak
Copy link
Collaborator

omerfirmak commented Mar 11, 2021

So, is this an issue with client code, or LocalRest ? I'm quite wary of introducing Exceptions that can be handled for specific LocalRest situation.

IIUC, with this we are almost silently ignoring closed connections. I feel like it should be handled at the client side, but not sure if it is possible to do in agora since we target both LocalRest and vibe.d.

@AndrejMitrovic
Copy link
Contributor Author

IIUC, with this we are almost silently ignoring closed connections.

We can catch it explicitly and throw a different exception. It will again lead to the node crashing in the tests.

But anyway we need some way of shutting down all nodes at once..

@AndrejMitrovic
Copy link
Contributor Author

Maybe some way of notifying all schedulers to ignore connection failures first, and then issuing the shutdown command..

@omerfirmak
Copy link
Collaborator

What about a watchdog in the main thread? We can check to see if any node dies prematurely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants