activerecord-sqlserver-adapter icon indicating copy to clipboard operation
activerecord-sqlserver-adapter copied to clipboard

Failed connections infinitely create file descriptors

Open joaquinrponce opened this issue 3 years ago • 0 comments

Issue

Whenever a connection is attempted, or a connection is lost, several file descriptors are opened and are never removed. This is a problem as our Puma server eventually hits the open file limit and crashes, as well as our delayed_job jobs eventually also hitting the file limit and manifesting different errors.

Expected behavior

Should not create infinite file descriptors.

Actual behavior

Creates file descriptors infinitely, removed only when the process for the application is killed.

How to reproduce

Use ActiveRecord and establish a connection to a database that is not available. Infinitely loop an attempt to run a query on that connection. Check the amount of file descriptors going up with each attempt, infinitely.

Details

  • Rails version: 5.2.8

  • SQL Server adapter version: 5.2.1

  • TinyTDS version: 2.1.2

  • FreeTDS details:

    Compile-time settings (established with the "configure" script)
                              Version: freetds v1.2.18
               freetds.conf directory: /usr/local/etc
       MS db-lib source compatibility: no
          Sybase binary compatibility: no
                        Thread safety: yes
                        iconv library: yes
                          TDS version: 7.3
                                iODBC: no
                             unixodbc: no
                SSPI "trusted" logins: no
                             Kerberos: no
                              OpenSSL: yes
                               GnuTLS: no
                                 MARS: yes
    

joaquinrponce avatar Jul 19 '22 23:07 joaquinrponce