-
Notifications
You must be signed in to change notification settings - Fork 368
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
Generally processing of exception with serial execution. #848
Generally processing of exception with serial execution. #848
Conversation
I detected some issues with exception and not forwarded failure during PR #844 . |
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.
This modification make me think about that old one : cede7b1
In this commit, I added try catch on AbstractLayer too.
About catching Exception
, I think maybe this is better to catch RuntimeException
because this doesn't hide future addition of checked exception. (this is just a details)
// no longer an observe option. Therefore check the | ||
// request for it. | ||
exchange.retransmitResponse(); | ||
} |
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.
This is totally out of topic because you just move this if block
from CoapEndpoint to BaseCoapStack but I can not get the point of it.
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.
I move it into the "try - catch". The CoapEndpoint, for some reasons, use
if (exchange.checkOwner()) {
// send response while processing exchange.
coapstack.sendResponse(exchange, response);
} else {
exchange.execute(new Runnable() {
@Override
public void run() {
coapstack.sendResponse(exchange, response);
}
});
}
In my very first variant, I used two try-catch, but moving it reduces that. And moving the if into the try-catch makes it somehow more complete.
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.
The question was more about the code itself (exchange.retransmitResponse) instead of the move. (that's why I notice that my question was totally out of topic :p)
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.
OK. A server-side-observe-exchange gets completed with the current response. Before sending the next notify, the Exchange must be prepared to accept that.
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.
Ok It's a bit clearer
(even If I do not really understand how we do that as the function just set the exchange as "not complete".
At first sight, I was confused because I thought that retransmitResponse
does "retransmit the previous response)
@@ -295,7 +305,7 @@ public void run() { | |||
return; | |||
} | |||
} catch (Exception ex) { | |||
LOGGER.error("error receiving response {} for {}", response, prev, ex); | |||
LOGGER.debug("error receiving response {} for {}", response, prev, ex); |
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.
Those 3 catch (Exception ex)
logged in DEBUG and now in ERROR.
Intuitively I would have let it in ERROR. Any reason about this change ?
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.
My intention was, that something received, which is broken, floods the log.
But I can go back to error, if you prefer.
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.
Is "warn" OK?
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.
My intention was, that something received, which is broken, floods the log.
I get the point, but in the same time, this will be hard to detect unexpected error if we let it in debug. So "warn" sounds reasonable.
block.addMessageObservers(request.getMessageObservers()); | ||
block.addMessageObserver(new FailureForwardingMessageObserver(request)); |
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.
This will not send event twice ?
one for : block.addMessageObservers(request.getMessageObservers());
and one for : block.addMessageObserver(new FailureForwardingMessageObserver(request));
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.
May be. Without it, a RST for a inner request "completes" the exchange, but the origin Request will never receive the reject.
(I found that, when the "assemble request" failed and rejected the last block request. The test show, that the exchange completes, but the test waits ...)
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.
FMPOV, solving that moves this PR out of M13.
In the past, the relation of inner and outer request was one of the pitfalls, which caused leaks. So I'm not sure, how much testing is needed, if it's changed more, to support "application-layer MessageObserver" as well.
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.
Or split that "forwarding" from this PR into a new PR, merge this for M13, and solve the "forwarding" later.
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.
I feel that block.addMessageObservers(request.getMessageObservers());
was not done for users but for house-keeping.
Maybe if you now add new FailureForwardingMessageObserver(request) which forwards error to the main request. the older block.addMessageObservers(request.getMessageObservers());
could be removed ?
But maybe we take the problem is the wrong way and we should ask : How we want this behave ?
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.
Let's split this PR after M13 and move the forwarding discussion to issue #818
* testFetchWithLargePayload(nl.teslanet.test.cf.Issue834Test): wrong | ||
* content length returned: expected:<8192> but was:<2012> Tests run: | ||
* 12, Failures: 4, Errors: 0, Skipped: 0 | ||
*/ |
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.
Is it intended to add this tests class in this PR ?
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.
Uups, I asked for that to be contributed by the author. It's "on the way", I remove it here.
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.
Removed
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.
It's now PR #849
receiver.receiveRequest(previous, request); | ||
} catch (Exception ex) { | ||
LOGGER.debug("error receiving request {} again!", request, ex); | ||
receiver.reject(request); |
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.
I'm not sure if sending RST is a good idea... 🤔
Did you consider to send an Internal Server Error Response ?
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.
I added those try-catch, because without, nothing happens.
For a "Internal Server Error Response" I would try to create more speaky ones.
If a Exception reaches that, I hope the log will help to fix the bug or create a speaky response.
There it will traverse more try-catches, but yes, generally, it's similar.
Makes sense. FMPOV you raise some question, which will take some more time to find better solutions. So, I would move that after M13. What do you think? |
a94f267
to
a40cb10
Compare
Switched to RuntimeException. |
a40cb10
to
fe36f57
Compare
👍 |
Move the complete PR after M13 or split the forwarding and move that after M13 ? |
I thought that you finally propose to complete the PR after the M13. So my 👍 was for this. But if you need this for M13 and want to split the forwarding. If have no objection. |
The "finally propose" was in the timeline before the propose to split it. But yes, move the complete PR after M13. |
Signed-off-by: Achim Kraus <[email protected]>
fe36f57
to
a87c5e8
Compare
I split the failure forwarding. Let's try to discus this ahead of solving it in issue #818 |
Except the block part for which I have some concern and for which we will discuss in #818. LGTM |
There are two block parts, the one is the try catch around the "next block request", the other was the removed failure forwarding. Do you refer only to the failure forwarding? |
Yes, only this part. |
Processes exceptions within the serialized execution consequently.
Forward failures on block request to the outer request.
Signed-off-by: Achim Kraus [email protected]