Found a bug with metasploit's python meterpreter. When it tries to use SSL to stage a full meterpreter the connection drops out and you get a "protocol error" message. It turns out the new line in the full meterpreter code being sent is killing the connection because of the use of the "send" method. Upgrading this to use the "sendall" method fixes this issue and the python meterpreter is fully staged correctly without any crashes.

Details at