Прерывистые 500 внутренних ошибок сервера в Redmine - PullRequest
0 голосов
/ 05 февраля 2020

Некоторые пользователи получают 500 ошибок при входе в систему и при попытке просмотра определенных страниц, или когда сервер простоял некоторое время или посещал страницу моего контроллера.

Ниже приведены производственные журналы, в которых произошла ошибка 500. :

Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.3ms)

ActiveRecord::StatementInvalid (Mysql2::Error: MySQL server has gone away: SELECT 
MAX(`settings`.`updated_on`) FROM `settings`):
  app/models/setting.rb:231:in `check_cache'
  app/controllers/application_controller.rb:90:in `user_setup'

Started GET "/" for 127.0.0.1 at 2019-12-29 08:52:50 +0000
Processing by MyController#page as HTML
Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.2ms)

ActiveRecord::StatementInvalid (Mysql2::Error: MySQL server has gone away: SELECT MAX(`settings`.`updated_on`) FROM `settings`):
  app/models/setting.rb:231:in `check_cache'
  app/controllers/application_controller.rb:90:in `user_setup'

Started GET "/" for 127.0.0.1 at 2019-12-29 08:52:56 +0000

Mysql2::Error (Can't connect to MySQL server on 'rds-prod-db-xxxxx.c3uzu7me4rud.us-east-1.rds.amazonaws.com' (111)):

Completed 500 Internal Server Error in 134ms (ActiveRecord: 69.2ms)

Вторая ошибка:

ActiveRecord::StatementInvalid (Mysql2::Error: Deadlock found when trying to get lock; try restarting transaction: UPDATE `issues` SET `issues`.`done_ratio` = 90, `issues`.`updated_on` = '2020-01-20 08:22:21', `issues`.`lock_version` = 49 WHERE `issues`.`id` = 328453 AND `issues`.`lock_version` = 48):
  app/models/issue.rb:210:in `create_or_update'
  app/models/issue.rb:1716:in `recalculate_attributes_for'
  app/models/issue.rb:1666:in `update_parent_attributes'
  app/models/issue.rb:210:in `create_or_update'
  app/controllers/issues_controller.rb:558:in `block in save_issue_with_child_records'
  app/controllers/issues_controller.rb:546:in `save_issue_with_child_records'
  app/controllers/issues_controller.rb:168:in `update'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Третья ошибка:

Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.2ms)

ActiveRecord::StatementInvalid (Mysql2::Error: MySQL server has gone away: UPDATE `tokens` SET `tokens`.`updated_on` = '2020-02-02 09:07:22' WHERE `tokens`.`user_id` = 289 AND `tokens`.`value` = 'a30e44e2ac37c8ba31eb383a409509c0d5fbb8be' AND `tokens`.`action` = 'session' AND (created_on > '2020-02-01 09:07:22') AND (updated_on > '2020-02-01 09:07:22')):
  app/models/user.rb:445:in `verify_session_token'
  app/controllers/application_controller.rb:77:in `session_expired?'
  app/controllers/application_controller.rb:67:in `session_expiration'

Started GET "/" for 127.0.0.1 at 2020-02-02 09:07:25 +0000

Я видел ранее на форумах redmine topi c, имеющую почти ту же проблему но пока не нашли решения. Информация: Окружение:

  Redmine version                3.4.4.stable
  Ruby version                   2.2.2-p95 (2015-04-13) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.7.14
  Git                            1.8.3.1
  Filesystem                     
Redmine plugins:
  redmine_query_share            2.1.0
  redmine_agile                  1.4.5
  sidebar_hide                   0.0.7

Ruby Сервер: Puma_maker_killer config:

PumaWorkerKiller.config do |config|
    config.ram           = 4096 # mb
    config.frequency     = 60   # seconds
    config.percent_usage = 0.90
    config.rolling_restart_frequency = 10 * 3600 # 12 hours in seconds, or 12.hours if using Rails
    config.reaper_status_logs = true # setting this to false will not log lines like:
    # PumaWorkerKiller: Consuming 54.34765625 mb with master and 2 workers.

    config.pre_term = -> (worker) { puts "Worker #{worker.inspect} being killed" 
  Thread: 4-16
  }
  end

Я очень плохо знаком с ruby на рельсах и Redmine. Любая помощь будет оценена. Благодаря.

1 Ответ

0 голосов
/ 26 февраля 2020

Я сталкивался с такого рода проблемами в прошлом и нашел решение путем обновления конфигурации MySQL (в my.cnf). Добавьте строку в файл конфигурации следующим образом:

[mysqld] 
max_allowed_packet=100M

Обычно вам не нужно перезагружать сервер MySQL.

...