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

possible TIMEOUT in libnetconf2 for yang-library retrieval in TLS #515

Open
tivadaralex opened this issue Oct 10, 2024 · 7 comments
Open
Labels
is:bug Bug description.

Comments

@tivadaralex
Copy link

Hello,

We have an issue with TIMEOUT on TLS after we send message with get for yanglib after 0.4 seconds (on SSH there is no timeout after 0.4 seconds)

Sending message:<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><get xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><filter type="xpath" xmlns:yanglib="urn:ietf:params:xml:ns:yang:ietf-yang-library" select ="/yanglib:*"/></get></rpc>
**nc WRN: Timeout for receiving reply to a <get> RPC expired.**

We tried to modify NC_READ_ACT_TIMEOUT at a higher value but we always have timeout after 0.4 seconds in TLS, in get_oper_data() function in session_client.c. nc_timeouttime_get() function modify it somehow.
I think you can reproduce it by adding a time.sleep between get rpc and received rpc

We suspect that might be a timeout in pthread_mutex_clocklock()

We use 3.0.17 version for libnetconf2 and 2.2.8 version for libyang

Can you please check why we have this timeout always, even if we increase that flag (NC_READ_ACT_TIMEOUT).

@michalvasko
Copy link
Member

I really do not know how to reproduce this and my guess is that there is something quite wrong on your end althought I am not sure what. What you can try, if you are using netopeer2-cli, to add parameter --rpc-timeout 5 to manually set the timeout for receiving the reply. But the default is definitely more than 400 ms.

@michalvasko michalvasko added the is:bug Bug description. label Oct 11, 2024
@tivadaralex
Copy link
Author

We are not using that netopeer2-cli.
There is another way to increase the timeout?
We tried to increase NC_READ_ACT_TIMEOUT, but in nc_timeouttime_get() function from session.c file some modifications are made for the timeout, can you please check also that?

@michalvasko
Copy link
Member

All the CLI does is pass the timeout to nc_recv_reply(), you can customize it yourself in your code. If you changing NC_READ_ACT_TIMEOUT makes no difference than I cannot help you, the issue is totally unknown to me and you will have to debug it yourself. Unless you provide the exact steps documenting how to reliably reproduce it.

@tivadaralex
Copy link
Author

Hello,
I found why we had 0.4 seconds timeout, in nc_read_poll() function from io.c file - for TLS we have a hardcoded value for timeout which is 400 (0.4 seconds) given to poll method. ret = poll(&fds, 1, 400); i think you can now reproduce it. The server responds in like 0.8 seconds now
Before in libnetconf2 the value was even smaller than this for TLS
Why libnetconf2 doesn't support that yang library to be sent later on?

@michalvasko
Copy link
Member

I have not found any fixed timeout of 400 ms for TLS, please point to the exact file and line.

@tivadaralex
Copy link
Author

So in the latest version there is ret = nc_poll(&fds, 1, io_timeout); line 450 in io.c file, but we have something like:
int pollTimeout = 400;
ret = poll(&fds, 1, pollTimeout);

@michalvasko
Copy link
Member

Do I understand it correctly, you have modified the code and set the timeout to 400 ms and now have a problem with it?

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

No branches or pull requests

2 participants