Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ssh client_loop send disconnnect from Dom0 -> DomU (NetBSD 10.0_BETA/Xen)



On Wed, 21 Jun 2023, Matthias Petermann wrote:

The log output at the time of the was:

```
debug2:  tcpwinsz: 197420 for connection: 3
debug2:  channel 0: window 1933312 sent adjust 163840
debug2:  tcpwinsz: 197420 for connection: 3
debug2:  channel 0: window 1933312 sent adjust 163840
debug2:  tcpwinsz: 197420 for connection: 3
debug2:  channel 0: window 1966080 sent adjust 131072
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i0/0 o0/0 e[write]/0 fd 6/7/8 sock -1 cc -1 io 0x01/0x00)

Connection to srv-net closed by remote host.
Transferred: sent 1119040, received 8256466228 bytes, in 374.4 seconds
Bytes per second: sent 2988.7, received 22051060.6
debug1: Exit status -1
```


Hmm. From the log, it looks like sshd just exited without even saying goodbye.
_One_ way to reproduce this is by killing the sshd instance handling the
transfer:

```
$ ssh -Elog.txt -vvv localhost 'dd if=/dev/zero bs=1m count=10000 msgfmt=quiet' >/dev/null &
$ su -l
/root# ps -Auxd | fgrep sshd
root 26071 0.0 0.0 11844 1536 pts/1 S+ 5:58AM 0:00.00 | `-- fgrep sshd root 16367 0.0 0.1 24712 3300 ? Ss 5:56AM 0:00.01 |-- sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups (sshd) root 5818 0.0 0.2 23404 8060 ? Ss 5:58AM 0:00.04 | `-- sshd: rvp [priv] rvp 16542 85.9 0.2 27628 9616 ? R 5:58AM 0:14.08 | `-- sshd: rvp@notty /root# kill 16542
```

results in:

```
debug2: channel 0: window 1966080 sent adjust 131072
debug2: tcpwinsz: 81920 for connection: 4
debug2: channel 0: window 1966080 sent adjust 131072
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i0/0 o0/0 e[write]/0 fd 5/6/7 sock -1 cc -1 io 0x01/0x00)

Transferred: sent 142108, received 911247684 bytes, in 8.5 seconds
Bytes per second: sent 16800.5, received 107730568.0
debug1: Exit status -1
```

or, even, as mlelstv@ pointed out, if the client attempts to write to the
socket:

```
debug2: channel 0: window 1966080 sent adjust 131072
debug2: tcpwinsz: 81920 for connection: 4
debug2: channel 0: window 1966080 sent adjust 131072
debug3: send packet: type 1
client_loop: send disconnect: Broken pipe
```

A normal closure (even if the program being run exits abnormally) looks like:

```
[...]
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype eow%openssh.com@localhost reply 0
debug2: channel 0: rcvd eow
debug2: chan_shutdown_read: channel 0: (i0 o0 sock -1 wfd 6 efd 8 [write])
debug2: channel 0: input open -> closed
[...]
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug3: channel 0: will not send data after close
debug2: channel 0: obuf empty
debug2: chan_shutdown_write: channel 0: (i3 o1 sock -1 wfd 7 efd 8 [write])
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/8 sock -1 cc -1 io 0x00/0x00)

debug3: send packet: type 1
Transferred: sent 19696, received 104925684 bytes, in 546.4 seconds
Bytes per second: sent 36.0, received 192032.2
debug1: Exit status 0
```

You can see the messages being exchanged to close the channel.

Can you see any errors from sshd(8) in the logs on the DomU?
If not, run the sshd server standalone like this:

```
/usr/sbin/sshd -Dddd -E/tmp/s.log
```

then post the `s.log' file after you run something like:

```
$ ssh -E/tmp/c.log -vvv XXX.NET 'dd if=/dev/zero bs=1m count=10000 msgfmt=quiet' >/dev/null
```

on the Dom0.

Thanks,
-RVP


Home | Main Index | Thread Index | Old Index