getRpcReply Method Blocks Until Data is Available From Netconf Device
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- java
- Domain
- networking
Research direction
Start in src/main/java/net/juniper/netconf/NetconfSession.java at getRpcReply and inspect how the SSH channel input stream is read before the timeout check. Review the adapted test cases mentioned in the issue. Done means the method returns or times out when the device sends no data or stops between chunks, rather than blocking indefinitely.
Written by the indexing model from the issue text.
Description
This is my very first Github issue so bear with me if I missed any important ritual.
I noticed that when Netconf device does not respond to a RPC request, Netconf client hangs. I investigated the issue and found that it waits to read from channel input stream: https://github.com/Juniper/netconf-java/blob/c0fbedac484e11eb1a290ff9a86eb356c5e78236/src/main/java/net/juniper/netconf/NetconfSession.java#L139
There is a timeout check in getRpcReply method in NetconfSession class but it only kicks in when there is data to be read from SSH channel input stream. Thus, there are 3 main problematic scenarios:
- If Netconf device never sends data, getRpcReply hangs forever.
- If Netconf device sends data in multiple chunks and stops sending anything before timeout is reached, getRpcReply hangs forever (technically same with scenario 1)
- Timeout is actually determined by the sent data. Let's say timeout is 1000ms and Netconf device sends data in 2000ms. In that case getRpcReply wait for 2000ms. If data has the prompt chars, timeout does not occur, otherwise it occurs after 2000ms.
Main reason is, underlying input stream of SSH channel (PipedInputStream) provides blocking read. Therefore, it is better to check if there is data to be read before attempting read operation.
I have submitted regarding fix and adapted test cases accordingly. Tbh, I am not very proficient with streams and I may have analyzed the issue or implemented fix wrong. Please thread carefully :)
- Dominant language
- Java
- Stars
- 90
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Juniper/netconf-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Juniper/netconf-java#85 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Juniper/netconf-java#81 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Juniper/netconf-java#75 · 5 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Juniper/netconf-java#69 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Juniper/netconf-java#68 · 2 comments ·
All issues in Juniper/netconf-java
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulty 2/5 1-3 hours Newbie friendliness 65/100