Update: it turns out that my simple script above (watch ‘sleep 3000;date’) also exits on 19.07.7 with the "client_loop: send disconnect: Broken pipe" error.
I have another script ( a long running backup job) that doesn't exit with the error when running 19.07.7, but does exit with the error when running the rc version. That script runs a backup (typically 2 - 3 minutes), then sleeps until the next hour starts and then runs again. So I'm not completely sure this is an openwrt bug, but there is certainly a change in behavior between the rc and the 19.07.x releases.
It seems that wireguard in 21.02.0-rc1 might be part of the cause.
SSH without wireguard is working fine for me when using the RC candidate.
SSH over a wireguard tunnel is where I start seeing the "client_loop: send disconnect: Broken pipe " error messages.
machine1 <-- wireguard --> OpenWRT A <--> internet <--> OpenWRT B <---> wireguard <---> machine2
The wireguard vpn is a site to site link. Both routers involved are running openwrt. Both have ports open so that either router can initiate the wireguard tunnel.
I am able to quickly and easily switch between 19.07.7 and 21.02.0-rc1 on OpenWRT router "A". 19.07.7 works great and ssh connections appear to stay alive indefinitely. 21.02.0-rc1 has the "client_loop: send disconnect: Broken pipe" problem and ssh connections typically exit early/unexpectedly.
Update: this may be related to #3373. I turned off the "Software flow offloading" on my router. With this change, the ssh connection that exits early seems to stay connected (it's been connected for several hours now). This connection is being made over IPv4 (not ipv6 like in #3373).
The attached patch should fix it for 21.02 (kernel 5.4).
"Should", as I was never knowingly affected by this issue, I just stumbled over it while being affected by FS#3373 (now #8239).
The patch effectively reverts kernel commit e97d940 and additionally picks all necessary changes from kernel commit 4592ee7f (which fixed the issue in kernel 5.15) while skipping stuff that kernel 5.4 doesn't have yet (ie. sysctl-configurable offload timeouts).