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

PLC4X-207 When a Handler Timeout occurs cancel the read future to not… #170

Merged
merged 1 commit into from
Feb 4, 2021

Conversation

JulianFeinauer
Copy link
Contributor

…ify the user.

@ottobackwards
Copy link
Contributor

This looks good. It would be nice if there were some tests for this though

+1

@JulianFeinauer
Copy link
Contributor Author

@ottobackwards I agree with you (I also would like to have a test), yet I'm unsure how we can provide a Test with lower complexity then the implementation. Perhaps @chrisdutz has an idea with his setup and the test suite?

Copy link
Contributor

@chrisdutz chrisdutz left a comment

Choose a reason for hiding this comment

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

LGTM

*/
@Override
protected void decode(ConversationContext<TPKTPacket> context, TPKTPacket msg) throws Exception {
throw new IllegalStateException("This should not happen!");
Copy link
Contributor

Choose a reason for hiding this comment

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

Well it actually could happen ... yesterday I noticed that error responses would go here ... but it's a good place for starting to implement some sort of error handling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chrisdutz yes. BUT the issue is that we want to notify people waiting on the response which is another thread which waits for a future.
One slution would be to have a set of all open futures for this connection and cancel all of them if this method is called ("undefined behavior"). I took the other way and notify the request / reply pattern when a connection si dropped (but nonetheless the paket will then go there).

Copy link
Contributor

Choose a reason for hiding this comment

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

I wasn't objecting ... I hope it didn't appear that way ... was more a pointer for myself to continue here to implement correct handling of errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just today did I push some changes that should help greatly with the decoding of errors in S7 ... the main problem was, that in case of an error, the response is not a S7MessageResponseData type, but a S7MessageResponse (without Data) ... I changed the code to wait for a S7Message with the given PDU Id and to handle that then ... so I think most bad errors were due to this ... perhaps the problem now will go away.

@chrisdutz
Copy link
Contributor

chrisdutz commented Jul 17, 2020

@ottobackwards I agree with you (I also would like to have a test), yet I'm unsure how we can provide a Test with lower complexity then the implementation. Perhaps @chrisdutz has an idea with his setup and the test suite?

Hi ... I think you should have a look at the XML-base IT framework ... here I can add delays which would be a perfect match for implementing such a test.

Please check out:
plc4j/drivers/s7/src/test/resources/testsuite/S7DriverIT.xml
Where I would also suggest to add the test to.

@chrisdutz
Copy link
Contributor

So right now I think we could probably add a test ... I do not want to force Julian to dig into my IT framework ... if you could explain the situation in which this code would kick in, I could probably come up with a testcase.

@splatch
Copy link
Contributor

splatch commented Nov 8, 2020

I actually re-implemented your fixes in #203 . :-/

@splatch
Copy link
Contributor

splatch commented Nov 12, 2020

I've pushed changes I made for other PR hence this one needs to be rebased/updated.

@splatch splatch force-pushed the feature/PLC4X-207-fix-silent-exception branch from e028de5 to 01f83be Compare December 15, 2020 11:41
@splatch
Copy link
Contributor

splatch commented Dec 15, 2020

I've updated code so it works with recent develop. Now S7 driver should properly handle timeouts.

Copy link
Contributor

@chrisdutz chrisdutz left a comment

Choose a reason for hiding this comment

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

Would be cool if you could fix the naming of the logger variable and re-add the exception for passive mode drivers

@JulianFeinauer
Copy link
Contributor Author

@splatch can this PR be closed and the branch be deletet? I think you did all that already in #203 , right?

…ify the user.

Author:    Julian Feinauer <j.feinauer@pragmaticminds.de>
Signed-off-by: Łukasz Dywicki <luke@code-house.org>
@splatch splatch force-pushed the feature/PLC4X-207-fix-silent-exception branch from 01f83be to d03cafb Compare February 4, 2021 21:57
@splatch splatch merged commit d03cafb into develop Feb 4, 2021
@splatch splatch deleted the feature/PLC4X-207-fix-silent-exception branch February 4, 2021 21:59
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.

None yet

4 participants