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

[tr064] reduce network load and improve XML handling #9693

Merged
merged 4 commits into from
Jan 9, 2021

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Jan 4, 2021

Fixes #9689

@J-N-K J-N-K added bug An unexpected problem or unintended behavior of an add-on additional testing preferred The change works for the pull request author. A test from someone else is preferred though. labels Jan 4, 2021
Signed-off-by: Jan N. Klug <[email protected]>
@cweitkamp
Copy link
Contributor

Yesterday I installed this version for testing. The reported issue in #9689 did not occur again. Unfortunately the timeout is still there, but not that often - it looks like the new timeout is not taken into account:

2021-01-06 14:57:26.436 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=macOnline, getAction=GetSpecificHostEntry, dataType='boolean, parameter='72:2E:43:A4:44:9E'}: java.util.concurrent.TimeoutException: Total timeout 2000 ms elapsed

Signed-off-by: Jan N. Klug <[email protected]>
@J-N-K
Copy link
Member Author

J-N-K commented Jan 6, 2021

There's two different timeouts, one for SOAP requests and the other for all other HTTP requests. I have now adjusted bothto 5s.

Signed-off-by: Jan N. Klug <[email protected]>
@J-N-K
Copy link
Member Author

J-N-K commented Jan 6, 2021

I also implementing caching for the SOAP requests. Especially for call lists there are many requests which are the same.

@cweitkamp
Copy link
Contributor

Looks good so far. No messages in my log anymore for more than twelve hours. Thank you for looking into it.

Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks. And it is working fine. No more warnings since nearly two days.

private final Logger logger = LoggerFactory.getLogger(SOAPConnector.class);
private final HttpClient httpClient;
private final String endpointBaseURL;
private final SOAPValueConverter soapValueConverter;

private final ExpiringCacheMap<SOAPRequest, SOAPMessage> soapMessageCache = new ExpiringCacheMap<>(
Copy link
Contributor

Choose a reason for hiding this comment

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

Only a minor remark. Why not passing the time value directly like here ? Or use Duration.of() to improve readability.

Copy link
Member Author

Choose a reason for hiding this comment

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

The stateCache can probably be omitted. Sinc ethe SOAP request to fill it is cached anyway. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we probably could remove that one.

Copy link
Member Author

Choose a reason for hiding this comment

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

OTOH, it bypasses the construction of the SOAP request and does not add much complexity now that it is here. So I would prefer to leave it in place.

Signed-off-by: Jan N. Klug <[email protected]>
@cweitkamp
Copy link
Contributor

I found another occurring message - is this handled differently?

2021-01-08 19:09:02.538 [INFO ] [064.internal.soap.SOAPValueConverter] - Postprocessor processTamListURL failed: Failed to get TAM list from URL https://<IP>:49443/tamcalllist.lua?sid=1156132f00cbd862&tamindex=0
2021-01-08 19:09:02.545 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=tamNewMessages, getAction=GetMessageList, dataType='string, parameter='0'}: failed to transform 'NewURL'

@J-N-K
Copy link
Member Author

J-N-K commented Jan 8, 2021

That request is not cached because there is only one request per answering machine. I wonder if the problem is that two requests are made in the same time (e.g. the request for the TAM list and a call list).

@cweitkamp
Copy link
Contributor

But there are two channels available for each TAM: tamEnable_n and tamNewMessages_n.

@J-N-K
Copy link
Member Author

J-N-K commented Jan 8, 2021

True. But „enabled“ is from a regular (cached) soap request (like getting the URL) and only „newMessages“ is an additional HTTP call.

Copy link
Contributor

@cweitkamp cweitkamp left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@cweitkamp cweitkamp merged commit ef87af3 into openhab:main Jan 9, 2021
@cweitkamp cweitkamp added this to the 3.1 milestone Jan 9, 2021
@J-N-K J-N-K deleted the tr064-2 branch January 9, 2021 16:39
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
* reduce network load
* adjust soap timeout

Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: John Marshall <[email protected]>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
* reduce network load
* adjust soap timeout

Signed-off-by: Jan N. Klug <[email protected]>
@wborn wborn removed the additional testing preferred The change works for the pull request author. A test from someone else is preferred though. label Dec 18, 2021
@sheilbronn
Copy link
Contributor

sheilbronn commented Dec 18, 2021

BTW: I still get these messages on OpenHAB 3.2.0~M5 and Fritzbox software release 7.29 irregularly :(

2021-12-18 16:12:28.064 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=tamNewMessages, getAction=GetMessageList, dataType='string, parameter='0'}: failed to transform 'NewURL'
2021-12-18 16:36:54.320 [INFO ] [064.internal.soap.SOAPValueConverter] - Postprocessor processTamListURL failed: Failed to get TAM list from URL https://192.168.178.1:49443/tamcalllist.lua?sid=42b240695a650bbf&tamindex=0
2021-12-18 16:36:54.322 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=tamNewMessages, getAction=GetMessageList, dataType='string, parameter='0'}: failed to transform 'NewURL'
2021-12-18 16:43:00.106 [INFO ] [064.internal.soap.SOAPValueConverter] - Postprocessor processTamListURL failed: Failed to get TAM list from URL https://192.168.178.1:49443/tamcalllist.lua?sid=42b240695a650bbf&tamindex=0
2021-12-18 16:43:00.108 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=tamNewMessages, getAction=GetMessageList, dataType='string, parameter='0'}: failed to transform 'NewURL'
2021-12-18 18:16:23.491 [INFO ] [064.internal.soap.SOAPValueConverter] - Postprocessor processTamListURL failed: Failed to get TAM list from URL https://192.168.178.1:49443/tamcalllist.lua?sid=42b240695a650bbf&tamindex=0
2021-12-18 18:16:23.493 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=tamNewMessages, getAction=GetMessageList, dataType='string, parameter='0'}: failed to transform 'NewURL'
2021-12-18 18:18:27.161 [INFO ] [064.internal.soap.SOAPValueConverter] - Postprocessor processTamListURL failed: Failed to get TAM list from URL https://192.168.178.1:49443/tamcalllist.lua?sid=42b240695a650bbf&tamindex=1
2021-12-18 18:18:27.162 [WARN ] [ng.tr064.internal.soap.SOAPConnector] - Failed to get Tr064ChannelConfig{channelType=tamNewMessages, getAction=GetMessageList, dataType='string, parameter='1'}: failed to transform 'NewURL'```

marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
* reduce network load
* adjust soap timeout

Signed-off-by: Jan N. Klug <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tr064] Failed to get call list
5 participants