Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
ncat client doesn't exit if server terminates first.
server client
|
ncat -l 8888 |
| ncat localhost 8888; echo $?
^C |
| # ncat keeps running, I have to
| # press enter twice to get EPIPE
|
Or with unix sockets:
server client
|
rm -f /tmp/nc.test |
ncat -l -U /tmp/nc.test |
| ncat -U /tmp/nc.test; echo $?
^C |
| # ncat keeps running, I have to
| # press enter to get EPIPE
|
With RHEL6.5 nc, client terminates as soon as server side terminates:
server client
|
nc -l 8888 |
| nc localhost 8888; echo $?
^C |
| 0
|
It seems to work fine when client terminates first:
server client
|
ncat -l 8888; echo $? |
| ncat localhost 8888
| ^C
0 |
|
server client
|
rm -f /tmp/nc.test |
ncat -l -U /tmp/nc.test; echo $? |
| ncat -U /tmp/nc.test
| ^C
0 |
|
Version-Release number of selected component (if applicable):
nmap-ncat-6.40-4.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
see description
Actual results:
client side remains running
Expected results:
if server is not running anymore, client should exit
Additional info:
This is a side effect of a feature.
ncat uses half-closed socket, so client/server can only read/write from the socket, not both.
S: ncat -l 8888
C: ncat localhost 8888
instead of terminating the server, try this instead:
S: HELLO
S: <Ctrl-D>
C: BYE
What happened is that server closed socket for writing by calling shutdown(sd, SHUT_WR). Client sees this and continues, because it can still send data (if you do not use --recv-only option).
Unfortunately, when socket is closed, ncat can't distinguish it whether it's closed or half closed, until it tries to send something.
IN SHORT: This is not a bug, but expected behaviour. There is even a check for this in upstream regression test suite:
"""PASS Client closes stdout and keeps running after socket EOF"""
I'm trying to discuss this with upstream if they would change the behaviour, but the response rate is really slow. I think, the chance for change is small, but to prevent close/re-open noise, I will move this bug to next release and hope I will have definitive answer by then.
Anyway, consider this bug as closed notabug/wontfix for the time being.
Description of problem: ncat client doesn't exit if server terminates first. server client | ncat -l 8888 | | ncat localhost 8888; echo $? ^C | | # ncat keeps running, I have to | # press enter twice to get EPIPE | Or with unix sockets: server client | rm -f /tmp/nc.test | ncat -l -U /tmp/nc.test | | ncat -U /tmp/nc.test; echo $? ^C | | # ncat keeps running, I have to | # press enter to get EPIPE | With RHEL6.5 nc, client terminates as soon as server side terminates: server client | nc -l 8888 | | nc localhost 8888; echo $? ^C | | 0 | It seems to work fine when client terminates first: server client | ncat -l 8888; echo $? | | ncat localhost 8888 | ^C 0 | | server client | rm -f /tmp/nc.test | ncat -l -U /tmp/nc.test; echo $? | | ncat -U /tmp/nc.test | ^C 0 | | Version-Release number of selected component (if applicable): nmap-ncat-6.40-4.el7.x86_64 How reproducible: 100% Steps to Reproduce: see description Actual results: client side remains running Expected results: if server is not running anymore, client should exit Additional info: