Fixed issue #1405 - Scheduler not running because of Bad file descriptor in PGConsumeInput().

This commit is contained in:
Martin Edenhofer 2017-09-25 23:47:37 +02:00
parent 18edd73c75
commit 1ba32b1a41
2 changed files with 6 additions and 2 deletions

View file

@ -12,10 +12,8 @@ class Scheduler < ApplicationModel
Thread.abort_on_exception = true
# reconnect in case db connection is lost
# See issue #1080
begin
ActiveRecord::Base.connection.reconnect!
rescue PG::UnableToSend => e # rubocop:disable Lint/HandleExceptions
rescue => e
logger.error "Can't reconnect to database #{e.inspect}"
end

View file

@ -16,6 +16,12 @@ require 'daemons'
def before_fork
# clear all connections before for, reconnect later ActiveRecord::Base.connection.reconnect!
# issue #1405 - Scheduler not running because of Bad file descriptor in PGConsumeInput()
# https://github.com/zammad/zammad/issues/1405
# see also https://bitbucket.org/ged/ruby-pg/issues/260/frequent-crashes-with-multithreading
ActiveRecord::Base.clear_all_connections!
# remember open file handles
@files_to_reopen = []
ObjectSpace.each_object(File) do |file|