backported fix for handling broken connection for mars cursors
backported fix for handling broken connection for mars cursors