When ZFS is used over ggate devises, ggated somehow receives 0 length read and results in terminating ggatec and ggated connection.
How to reproduce:
% mdconfig -a -t swap -s 1GB
% echo 127.0.0.1 RW /dev/md0 > /tmp/ggated.conf
% ggated /tmp/ggated.conf
% ggatec create -orw 127.0.0.1 /dev/md0
% zpool create -m /mnt/test test /dev/ggate0
% cp -pr /usr/src/ /mnt/test/
ggate connection is dropped randomly.
After running truss, I discovered that ggated read 0 length input from a socket and closes the connection although ggatec does not write 0 length over the connection. As a result, ggatec terminates its connection as well and zfs/cp hangs.
I could not reproduce the problem on ElectroBSD based on 11.4-STABLE r368530.
The cp fails with "No space left on device" as can be expected from the small pool size.
I'm wondering if you're running into ggated recv_thread() queuing incomplete WRITE requests.
I've reported this and other ggate-related issues in 2015 to <security-officer@FreeBSD.org> but AFAIK it still hasn't been fixed upstream.
You could try the patch from: