Skip to content
Snippets Groups Projects
  • Deucе's avatar
    ba5759c2
    Close Socket on unhandled TLS errors · ba5759c2
    Deucе authored
    While errors on transmit seem to be handled well, errors on receive
    do not, especially through js_recv_line() which has been seen to
    trigger a large number (hundreds) of ECONNRESET errors.  To prevent
    this, simply close the socket when an otherwise unhandled error
    occurs.
    
    Almost certainly fixes that issue, but the underlying cause is still
    undetermined.  The calling script (imapservice.js) was checking
    Socket.is_connected after each recv_line() call, so if the socket
    was actually reset, it would be expected to only call it once.
    
    An alternative would be to explicitly handle the error that is
    seen (CRYPT_ERROR_PARAM1), but let's try a generic fix first and see
    of anything breaks because of it.  Most likely issue would be an
    inability to recv() data after calling shutdown(), but I don't think
    many people do that except to move the TIME_WAIT to where they want
    it.
    ba5759c2
    History
    Close Socket on unhandled TLS errors
    Deucе authored
    While errors on transmit seem to be handled well, errors on receive
    do not, especially through js_recv_line() which has been seen to
    trigger a large number (hundreds) of ECONNRESET errors.  To prevent
    this, simply close the socket when an otherwise unhandled error
    occurs.
    
    Almost certainly fixes that issue, but the underlying cause is still
    undetermined.  The calling script (imapservice.js) was checking
    Socket.is_connected after each recv_line() call, so if the socket
    was actually reset, it would be expected to only call it once.
    
    An alternative would be to explicitly handle the error that is
    seen (CRYPT_ERROR_PARAM1), but let's try a generic fix first and see
    of anything breaks because of it.  Most likely issue would be an
    inability to recv() data after calling shutdown(), but I don't think
    many people do that except to move the TIME_WAIT to where they want
    it.