I had this problem because I made a mistake in my shell startup script. As in this answer, I had replaced the return near the top of .bashrc with an exit. Undoing that change fixed both rsync and non-interactive ssh for me.
return
exit