Bug 156835
| Summary: | nc enters infinite loop when pipe closes. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | David Woodhouse <dwmw2> | ||||
| Component: | nc | Assignee: | Radek Vokál <rvokal> | ||||
| Status: | CLOSED RAWHIDE | QA Contact: | Ben Levenson <benl> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | medium | ||||||
| Version: | rawhide | ||||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | All | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | 1.78-2 | Doc Type: | Bug Fix | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2005-05-11 10:41:41 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
David, may I have some steps how to reproduce this? I'd imagine this should trigger it for you fairly easily... cat >> ~/.ssh/config <<EOF Host * ProxyCommand nc %h %p EOF Any progress? If you added that to your SSH configuration you ought to be seeing a lot of this now... Nope, I still don't see this. Running nc host 22 gives no errors and if I try your steps, I see that nc is running while sshed and after closing the ssh session nc ends corectly .. #0 0x0ff43cb8 in poll () from /lib/libc.so.6 #1 0x10001928 in readwrite (nfd=3) at netcat.c:615 #2 0x10002278 in main (argc=Variable "argc" is not available. ) at netcat.c:375 Created attachment 114240 [details]
strace of offending nc.
The else branch looks really strange to me. If you're calling exec on nc, should this create a whole new shell for nc? That's maybe why it's still open after closing ssh session. fsh isn't a shell. It's a faster version of ssh, which re-uses a single authenticated connection for running multiple commands. The logic is "if we're within the internal network use netcat, else ssh to the bastion host and run netcat there". It's the former case which is failing. I don't actually know why it's not 'exec nc' in the first case, which does also work around the problem -- but fixing netcat to react appropriately to POLLHUP is also appropriate. |
nc is being used as a ssh ProxyCommand. When SSH is finished with it it ought to die gracefully. It doesn't; it ends up eating CPU... poll([{fd=4, events=POLLIN}, {fd=0, events=POLLIN, revents=POLLHUP}], 2, -1) = 1 poll([{fd=4, events=POLLIN}, {fd=0, events=POLLIN, revents=POLLHUP}], 2, -1) = 1 poll([{fd=4, events=POLLIN}, {fd=0, events=POLLIN, revents=POLLHUP}], 2, -1) = 1 poll([{fd=4, events=POLLIN}, {fd=0, events=POLLIN, revents=POLLHUP}], 2, -1) = 1 poll([{fd=4, events=POLLIN}, {fd=0, events=POLLIN, revents=POLLHUP}], 2, -1) = 1