# rsync closing connection with code 12 error



## drobison (Apr 11, 2020)

Hiya,

Just replaced a server today and was doing some routine rsync transfers. Been doing this for years.

Now a repeatable error has presented itself:

Server #1 is using the bge driver, server #2 is using the ixl driver, but it is throttled to 1gb since that's all our cisco will handle.

I've had this error pulling to server #1 from server #2:


```
rsync: connection unexpectedly closed (244135029 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [receiver=3.1.3]
rsync: connection unexpectedly closed (82830 bytes received so far) [generator]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [generator=3.1.3]
```

and pushing from server #2 to server #1 I've gotten this error:


```
ssh_packet_write_poll: Connection to 10.242.181.36 port 22: Cannot allocate memory
rsync: [sender] write error: Broken pipe (32)
rsync error: unexplained error (code 255) at io.c(820) [sender=3.1.3]
```
I am running ipfw so I put in a rule #1 which just says allow all traffic to and from these two servers. Crash still occurs.

I've never seen this before. Hoping someone recognizes this and has some suggestions.


----------



## trev (Apr 14, 2020)

I'm sure your favourite search engine will have some suggestions in he absence of any here.


----------



## richardtoohey2 (Apr 14, 2020)

Don't think it's the case here but the only time I had rsync issues was faulty RAM.  The message I got was nothing to do with RAM (similar to the above - lost connections) it was just something I tried after banging my head on the walls thinking of (and eliminating) a million (well, it felt like it!) possible network issues.

So don't think I'm being a great help other than don't assume it's rsync or a firewall or network error - it _might_ be some other component issue (like RAM in my case.) Just what you need, more possibilities!


----------



## drobison (Apr 14, 2020)

OK I figured it out. With the help of the brilliant Devin Teske.

This server runs a few standard jails and one vimage/netgraph jail. I never had any issue until I fired up the jails, at which point sup and rsync started having this error.

The fix is to put the following values into /boot/loader.conf:


```
net.inet.tcp.sendspace=524288
net.inet.tcp.recvspace=524288
net.local.stream.recvspace=524288
net.local.stream.sendspace=524288

net.graph.threads=240
net.graph.maxdata=65536
net.graph.maxalloc=65536
net.graph.recvspace=450000
net.graph.maxdgram=450000
```


----------

