TinyTds::Error (closed connection): when using Apache2 and Passenger












0















When I start my application using Puma on port 3000 everything works as expected. When I try to access the application after starting Apache, using the default port 80, I get the error "TinyTds::Error (closed connection):". The code at the point of the error is trying to read a remote MSSQL database. What could be some of the reasons that the connection is closed when using Apache/Passenger? I am using Ruby 2.5.3, Rails 5.1.6.1, Apache2 2.4.29, Ubuntu 18.4, Passenger 6.0.1, Tiny_tds 1.3.0, Activerecord-sqlserver-adapter 5.1.6.



The sites-enabled config file is as follows;



NameVirtualHost *:80

<VirtualHost *:80>
ServerName 10.0.0.185
ServerAlias 10.0.0.185
ServerAdmin webmaster@localhost
PassengerFriendlyErrorPages on
DocumentRoot /home/billj/sites/turkeytote/public
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
<Directory "/home/billj/sites/turkeytote/public">
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>


The apache2 error.log file is as follows;



App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
App 29739 output:
App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
App 29739 output:
[Thu Jan 31 15:44:20.538347 2019] [mpm_event:notice] [pid 29587:tid 140174977215424] AH00491: caught SIGTERM, shutting down

[ N 2019-01-31 15:44:20.5402 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ N 2019-01-31 15:44:20.5502 29594/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
App 29739 output: [ 2019-01-31 15:44:20.5401 29739/0x000055b300251800(Worker 1) utils.rb ]: *** Exception IOError (stream closed in another thread) (process 29739, thread 0x000055b300251800(Worker 1)):
App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept'
App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept_and_process_next_request'
App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
[ N 2019-01-31 15:44:20.5542 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
[ N 2019-01-31 15:44:20.6104 29594/T9 Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
[ N 2019-01-31 15:44:20.6104 29594/T7 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
[ N 2019-01-31 15:44:20.6105 29594/T9 Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
[ N 2019-01-31 15:44:20.6106 29594/T7 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
[ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
[ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:558 ]: [ApiServer] Shutdown finished

[ N 2019-01-31 15:44:20.6183 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 1 more time(s) to force shutdown)
[ N 2019-01-31 15:44:20.6210 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
[ N 2019-01-31 15:44:21.2607 29594/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
[ N 2019-01-31 15:44:35.1179 2622/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
[ N 2019-01-31 15:44:35.1518 2663/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
[ N 2019-01-31 15:44:35.1527 2663/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2019-01-31 15:44:35.1677 2663/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2663

[ N 2019-01-31 15:44:35.1869 2663/T8 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
[ N 2019-01-31 15:44:35.1876 2663/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
[ N 2019-01-31 15:44:35.1883 2663/Ta Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
[ N 2019-01-31 15:44:35.1890 2663/Ta Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
[ N 2019-01-31 15:44:35.1897 2663/T8 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
[ N 2019-01-31 15:44:35.1905 2663/T8 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
[ N 2019-01-31 15:44:35.1905 2663/Td Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
[ N 2019-01-31 15:44:35.1906 2663/Td Ser/Server.h:558 ]: [ApiServer] Shutdown finished
[ N 2019-01-31 15:44:35.2527 2741/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
[ N 2019-01-31 15:44:35.2872 2748/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
[ N 2019-01-31 15:44:35.2874 2748/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2019-01-31 15:44:35.3001 2748/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2748
[Thu Jan 31 15:44:35.303125 2019] [mpm_event:notice] [pid 2739:tid 140555193084864] AH00489: Apache/2.4.29 (Ubuntu) Phusion_Passenger/6.0.1 configured -- resuming normal operations
[Thu Jan 31 15:44:35.303308 2019] [core:notice] [pid 2739:tid 140555193084864] AH00094: Command line: '/usr/sbin/apache2'
[ N 2019-01-31 15:44:35.6433 2663/T1 age/Cor/TelemetryCollector.h:531 ]: Message from Phusion: End time can not be before or equal to begin time
[ N 2019-01-31 15:44:35.6753 2663/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
[ N 2019-01-31 15:44:37.7804 2748/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
App 2987 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
App 2987 output:









share|improve this question









New contributor




William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    When I start my application using Puma on port 3000 everything works as expected. When I try to access the application after starting Apache, using the default port 80, I get the error "TinyTds::Error (closed connection):". The code at the point of the error is trying to read a remote MSSQL database. What could be some of the reasons that the connection is closed when using Apache/Passenger? I am using Ruby 2.5.3, Rails 5.1.6.1, Apache2 2.4.29, Ubuntu 18.4, Passenger 6.0.1, Tiny_tds 1.3.0, Activerecord-sqlserver-adapter 5.1.6.



    The sites-enabled config file is as follows;



    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName 10.0.0.185
    ServerAlias 10.0.0.185
    ServerAdmin webmaster@localhost
    PassengerFriendlyErrorPages on
    DocumentRoot /home/billj/sites/turkeytote/public
    ErrorLog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log combined
    <Directory "/home/billj/sites/turkeytote/public">
    Options FollowSymLinks
    Require all granted
    </Directory>
    </VirtualHost>


    The apache2 error.log file is as follows;



    App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
    App 29739 output:
    App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
    App 29739 output:
    [Thu Jan 31 15:44:20.538347 2019] [mpm_event:notice] [pid 29587:tid 140174977215424] AH00491: caught SIGTERM, shutting down

    [ N 2019-01-31 15:44:20.5402 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
    [ N 2019-01-31 15:44:20.5502 29594/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
    App 29739 output: [ 2019-01-31 15:44:20.5401 29739/0x000055b300251800(Worker 1) utils.rb ]: *** Exception IOError (stream closed in another thread) (process 29739, thread 0x000055b300251800(Worker 1)):
    App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept'
    App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept_and_process_next_request'
    App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
    App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
    App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
    [ N 2019-01-31 15:44:20.5542 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
    [ N 2019-01-31 15:44:20.6104 29594/T9 Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
    [ N 2019-01-31 15:44:20.6104 29594/T7 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
    [ N 2019-01-31 15:44:20.6105 29594/T9 Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
    [ N 2019-01-31 15:44:20.6106 29594/T7 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
    [ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
    [ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:558 ]: [ApiServer] Shutdown finished

    [ N 2019-01-31 15:44:20.6183 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 1 more time(s) to force shutdown)
    [ N 2019-01-31 15:44:20.6210 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
    [ N 2019-01-31 15:44:21.2607 29594/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
    [ N 2019-01-31 15:44:35.1179 2622/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
    [ N 2019-01-31 15:44:35.1518 2663/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
    [ N 2019-01-31 15:44:35.1527 2663/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
    [ N 2019-01-31 15:44:35.1677 2663/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2663

    [ N 2019-01-31 15:44:35.1869 2663/T8 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
    [ N 2019-01-31 15:44:35.1876 2663/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
    [ N 2019-01-31 15:44:35.1883 2663/Ta Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
    [ N 2019-01-31 15:44:35.1890 2663/Ta Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
    [ N 2019-01-31 15:44:35.1897 2663/T8 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
    [ N 2019-01-31 15:44:35.1905 2663/T8 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
    [ N 2019-01-31 15:44:35.1905 2663/Td Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
    [ N 2019-01-31 15:44:35.1906 2663/Td Ser/Server.h:558 ]: [ApiServer] Shutdown finished
    [ N 2019-01-31 15:44:35.2527 2741/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
    [ N 2019-01-31 15:44:35.2872 2748/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
    [ N 2019-01-31 15:44:35.2874 2748/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
    [ N 2019-01-31 15:44:35.3001 2748/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2748
    [Thu Jan 31 15:44:35.303125 2019] [mpm_event:notice] [pid 2739:tid 140555193084864] AH00489: Apache/2.4.29 (Ubuntu) Phusion_Passenger/6.0.1 configured -- resuming normal operations
    [Thu Jan 31 15:44:35.303308 2019] [core:notice] [pid 2739:tid 140555193084864] AH00094: Command line: '/usr/sbin/apache2'
    [ N 2019-01-31 15:44:35.6433 2663/T1 age/Cor/TelemetryCollector.h:531 ]: Message from Phusion: End time can not be before or equal to begin time
    [ N 2019-01-31 15:44:35.6753 2663/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
    [ N 2019-01-31 15:44:37.7804 2748/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
    App 2987 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
    App 2987 output:









    share|improve this question









    New contributor




    William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      When I start my application using Puma on port 3000 everything works as expected. When I try to access the application after starting Apache, using the default port 80, I get the error "TinyTds::Error (closed connection):". The code at the point of the error is trying to read a remote MSSQL database. What could be some of the reasons that the connection is closed when using Apache/Passenger? I am using Ruby 2.5.3, Rails 5.1.6.1, Apache2 2.4.29, Ubuntu 18.4, Passenger 6.0.1, Tiny_tds 1.3.0, Activerecord-sqlserver-adapter 5.1.6.



      The sites-enabled config file is as follows;



      NameVirtualHost *:80

      <VirtualHost *:80>
      ServerName 10.0.0.185
      ServerAlias 10.0.0.185
      ServerAdmin webmaster@localhost
      PassengerFriendlyErrorPages on
      DocumentRoot /home/billj/sites/turkeytote/public
      ErrorLog /var/log/apache2/error.log
      CustomLog /var/log/apache2/access.log combined
      <Directory "/home/billj/sites/turkeytote/public">
      Options FollowSymLinks
      Require all granted
      </Directory>
      </VirtualHost>


      The apache2 error.log file is as follows;



      App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
      App 29739 output:
      App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
      App 29739 output:
      [Thu Jan 31 15:44:20.538347 2019] [mpm_event:notice] [pid 29587:tid 140174977215424] AH00491: caught SIGTERM, shutting down

      [ N 2019-01-31 15:44:20.5402 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
      [ N 2019-01-31 15:44:20.5502 29594/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
      App 29739 output: [ 2019-01-31 15:44:20.5401 29739/0x000055b300251800(Worker 1) utils.rb ]: *** Exception IOError (stream closed in another thread) (process 29739, thread 0x000055b300251800(Worker 1)):
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept_and_process_next_request'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
      [ N 2019-01-31 15:44:20.5542 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
      [ N 2019-01-31 15:44:20.6104 29594/T9 Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
      [ N 2019-01-31 15:44:20.6104 29594/T7 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
      [ N 2019-01-31 15:44:20.6105 29594/T9 Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
      [ N 2019-01-31 15:44:20.6106 29594/T7 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
      [ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
      [ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:558 ]: [ApiServer] Shutdown finished

      [ N 2019-01-31 15:44:20.6183 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 1 more time(s) to force shutdown)
      [ N 2019-01-31 15:44:20.6210 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
      [ N 2019-01-31 15:44:21.2607 29594/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
      [ N 2019-01-31 15:44:35.1179 2622/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
      [ N 2019-01-31 15:44:35.1518 2663/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
      [ N 2019-01-31 15:44:35.1527 2663/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
      [ N 2019-01-31 15:44:35.1677 2663/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2663

      [ N 2019-01-31 15:44:35.1869 2663/T8 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
      [ N 2019-01-31 15:44:35.1876 2663/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
      [ N 2019-01-31 15:44:35.1883 2663/Ta Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
      [ N 2019-01-31 15:44:35.1890 2663/Ta Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
      [ N 2019-01-31 15:44:35.1897 2663/T8 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
      [ N 2019-01-31 15:44:35.1905 2663/T8 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
      [ N 2019-01-31 15:44:35.1905 2663/Td Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
      [ N 2019-01-31 15:44:35.1906 2663/Td Ser/Server.h:558 ]: [ApiServer] Shutdown finished
      [ N 2019-01-31 15:44:35.2527 2741/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
      [ N 2019-01-31 15:44:35.2872 2748/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
      [ N 2019-01-31 15:44:35.2874 2748/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
      [ N 2019-01-31 15:44:35.3001 2748/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2748
      [Thu Jan 31 15:44:35.303125 2019] [mpm_event:notice] [pid 2739:tid 140555193084864] AH00489: Apache/2.4.29 (Ubuntu) Phusion_Passenger/6.0.1 configured -- resuming normal operations
      [Thu Jan 31 15:44:35.303308 2019] [core:notice] [pid 2739:tid 140555193084864] AH00094: Command line: '/usr/sbin/apache2'
      [ N 2019-01-31 15:44:35.6433 2663/T1 age/Cor/TelemetryCollector.h:531 ]: Message from Phusion: End time can not be before or equal to begin time
      [ N 2019-01-31 15:44:35.6753 2663/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
      [ N 2019-01-31 15:44:37.7804 2748/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
      App 2987 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
      App 2987 output:









      share|improve this question









      New contributor




      William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      When I start my application using Puma on port 3000 everything works as expected. When I try to access the application after starting Apache, using the default port 80, I get the error "TinyTds::Error (closed connection):". The code at the point of the error is trying to read a remote MSSQL database. What could be some of the reasons that the connection is closed when using Apache/Passenger? I am using Ruby 2.5.3, Rails 5.1.6.1, Apache2 2.4.29, Ubuntu 18.4, Passenger 6.0.1, Tiny_tds 1.3.0, Activerecord-sqlserver-adapter 5.1.6.



      The sites-enabled config file is as follows;



      NameVirtualHost *:80

      <VirtualHost *:80>
      ServerName 10.0.0.185
      ServerAlias 10.0.0.185
      ServerAdmin webmaster@localhost
      PassengerFriendlyErrorPages on
      DocumentRoot /home/billj/sites/turkeytote/public
      ErrorLog /var/log/apache2/error.log
      CustomLog /var/log/apache2/access.log combined
      <Directory "/home/billj/sites/turkeytote/public">
      Options FollowSymLinks
      Require all granted
      </Directory>
      </VirtualHost>


      The apache2 error.log file is as follows;



      App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
      App 29739 output:
      App 29739 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
      App 29739 output:
      [Thu Jan 31 15:44:20.538347 2019] [mpm_event:notice] [pid 29587:tid 140174977215424] AH00491: caught SIGTERM, shutting down

      [ N 2019-01-31 15:44:20.5402 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
      [ N 2019-01-31 15:44:20.5502 29594/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
      App 29739 output: [ 2019-01-31 15:44:20.5401 29739/0x000055b300251800(Worker 1) utils.rb ]: *** Exception IOError (stream closed in another thread) (process 29739, thread 0x000055b300251800(Worker 1)):
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:133:in `accept_and_process_next_request'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_threads'
      App 29739 output: from /var/lib/gems/2.5.0/gems/passenger-6.0.1/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
      [ N 2019-01-31 15:44:20.5542 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
      [ N 2019-01-31 15:44:20.6104 29594/T9 Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
      [ N 2019-01-31 15:44:20.6104 29594/T7 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
      [ N 2019-01-31 15:44:20.6105 29594/T9 Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
      [ N 2019-01-31 15:44:20.6106 29594/T7 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
      [ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
      [ N 2019-01-31 15:44:20.6118 29594/Tc Ser/Server.h:558 ]: [ApiServer] Shutdown finished

      [ N 2019-01-31 15:44:20.6183 29594/T7 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 1 more time(s) to force shutdown)
      [ N 2019-01-31 15:44:20.6210 29594/T1 age/Cor/CoreMain.cpp:1146 ]: Checking whether to disconnect long-running connections for process 29739, application /home/billj/sites/turkeytote (production)
      [ N 2019-01-31 15:44:21.2607 29594/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
      [ N 2019-01-31 15:44:35.1179 2622/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
      [ N 2019-01-31 15:44:35.1518 2663/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
      [ N 2019-01-31 15:44:35.1527 2663/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
      [ N 2019-01-31 15:44:35.1677 2663/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2663

      [ N 2019-01-31 15:44:35.1869 2663/T8 age/Cor/CoreMain.cpp:671 ]: Signal received. Gracefully shutting down... (send signal 2 more time(s) to force shutdown)
      [ N 2019-01-31 15:44:35.1876 2663/T1 age/Cor/CoreMain.cpp:1245 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected...
      [ N 2019-01-31 15:44:35.1883 2663/Ta Ser/Server.h:902 ]: [ServerThr.2] Freed 0 spare client objects
      [ N 2019-01-31 15:44:35.1890 2663/Ta Ser/Server.h:558 ]: [ServerThr.2] Shutdown finished
      [ N 2019-01-31 15:44:35.1897 2663/T8 Ser/Server.h:902 ]: [ServerThr.1] Freed 0 spare client objects
      [ N 2019-01-31 15:44:35.1905 2663/T8 Ser/Server.h:558 ]: [ServerThr.1] Shutdown finished
      [ N 2019-01-31 15:44:35.1905 2663/Td Ser/Server.h:902 ]: [ApiServer] Freed 0 spare client objects
      [ N 2019-01-31 15:44:35.1906 2663/Td Ser/Server.h:558 ]: [ApiServer] Shutdown finished
      [ N 2019-01-31 15:44:35.2527 2741/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
      [ N 2019-01-31 15:44:35.2872 2748/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
      [ N 2019-01-31 15:44:35.2874 2748/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
      [ N 2019-01-31 15:44:35.3001 2748/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 2748
      [Thu Jan 31 15:44:35.303125 2019] [mpm_event:notice] [pid 2739:tid 140555193084864] AH00489: Apache/2.4.29 (Ubuntu) Phusion_Passenger/6.0.1 configured -- resuming normal operations
      [Thu Jan 31 15:44:35.303308 2019] [core:notice] [pid 2739:tid 140555193084864] AH00094: Command line: '/usr/sbin/apache2'
      [ N 2019-01-31 15:44:35.6433 2663/T1 age/Cor/TelemetryCollector.h:531 ]: Message from Phusion: End time can not be before or equal to begin time
      [ N 2019-01-31 15:44:35.6753 2663/T1 age/Cor/CoreMain.cpp:1324 ]: Passenger core shutdown finished
      [ N 2019-01-31 15:44:37.7804 2748/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
      App 2987 output: /var/lib/gems/2.5.0/gems/tiny_tds-1.3.0/lib/tiny_tds/client.rb:53: warning: TinyTds: :use_utf16 option not supported in this version of FreeTDS.
      App 2987 output:






      apache2 rails mssql






      share|improve this question









      New contributor




      William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 2 days ago









      Kristopher Ives

      2,59811322




      2,59811322






      New contributor




      William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 days ago









      William JonesWilliam Jones

      1




      1




      New contributor




      William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      William Jones is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          William Jones is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1114551%2ftinytdserror-closed-connection-when-using-apache2-and-passenger%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          William Jones is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          William Jones is a new contributor. Be nice, and check out our Code of Conduct.













          William Jones is a new contributor. Be nice, and check out our Code of Conduct.












          William Jones is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1114551%2ftinytdserror-closed-connection-when-using-apache2-and-passenger%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How did Captain America manage to do this?

          迪纳利

          南乌拉尔铁路局