Solving "ssh_exchange_identification: read: Connection reset by peer" after some long execution


I ran the file having process time-consuming and using a lot of memory on the server.
Whenever it is executed, ssh connection is down.

Reason in this case

Swap might be "off". So you should turn Swap on.
If you can, increase memory on the server.
In my case, since I used instance in AWS, I graded up the plan.

The short of memory causes not working every other instructions.

Even if you cannot run the following command on another terminal in the sever, your case might be one of this case.

$ vi hoge

However, because this case is a special case, it's not normal solution.
If you can vi hoge or some another execution returns soon, this is not an answer.
You'd better continue to goolge.