Rails 5 ActionView :: Template ::控制器#action中发生错误:"嵌套事务"

Kod*_*dak 5 ruby-on-rails-5.1

我最近从4个轨道迁移到最新的5.1轨道(从瘦到puma服务器).我有一个不可重复的错误,我无法追踪它的来源.下面是一个示例应用程序回溯:

  app/views/reports/_transaction_dialog.html.erb:88:in `_app_views_report=
s__transaction_dialog_html_erb___259516699_72100400'
  app/views/reports/show.html.erb:40:in `block in _app_views_reports_show=
_html_erb___439575899_73388840'
  app/views/reports/show.html.erb:38:in `_app_views_reports_show_html_erb=
___439575899_73388840'
  app/controllers/application_controller.rb:52:in `block in select_shard'=

  app/controllers/application_controller.rb:48:in `select_shard'
Run Code Online (Sandbox Code Playgroud)

我知道它并没有多说......它只是一个部分渲染.它发生在代码的不同位置,但通常在app使用flipper来检查功能可用性的地方.这里_transaction_dialog.html.erb:88有:

      <% if $flipper[:schooling].enabled? current_user %>
Run Code Online (Sandbox Code Playgroud)

我会尝试将其报告给鳍状肢,但也许有人有其他想法?我使用章鱼进行数据库分片.Gemfile.lock如下:

GIT
  remote: https://github.com/zquestz/omniauth-google-oauth2
  revision: 605f483311a1885d87fa636791faba109ff37221
  branch: master
  specs:
    omniauth-google-oauth2 (0.5.2)
      jwt (~> 1.5)
      omniauth (>= 1.1.1)
      omniauth-oauth2 (>= 1.3.1)

GEM
  remote: https://rubygems.org/
  remote: https://rails-assets.org/
  specs:
    actioncable (5.1.4)
      actionpack (= 5.1.4)
      nio4r (~> 2.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.1.4)
      actionpack (= 5.1.4)
      actionview (= 5.1.4)
      activejob (= 5.1.4)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.1.4)
      actionview (= 5.1.4)
      activesupport (= 5.1.4)
      rack (~> 2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.1.4)
      activesupport (= 5.1.4)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.1.4)
      activesupport (= 5.1.4)
      globalid (>= 0.3.6)
    activemodel (5.1.4)
      activesupport (= 5.1.4)
    activerecord (5.1.4)
      activemodel (= 5.1.4)
      activesupport (= 5.1.4)
      arel (~> 8.0)
    activerecord-sqlserver-adapter (5.1.2)
      activerecord (~> 5.1.0)
      tiny_tds
    activesupport (5.1.4)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (~> 0.7)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.5.2)
      public_suffix (>= 2.0.2, < 4.0)
    ar-octopus (0.9.1)
      activerecord (>= 4.0.0)
      activesupport (>= 4.0.0)
    arel (8.0.0)
    autoprefixer-rails (7.1.6)
      execjs
    axlsx (1.3.6)
      htmlentities (~> 4.3.1)
      nokogiri (>= 1.4.1)
      rubyzip (>= 0.9.5)
    bcrypt (3.1.11-x64-mingw32)
    bcrypt (3.1.11-x86-mingw32)
    bootstrap-sass (3.3.7)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap_form (2.7.0)
    builder (3.2.3)
    byebug (9.1.0)
    cmxl (0.2.0)
      rchardet19
    cocoon (1.2.11)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    crass (1.0.3)
    declarative (0.0.10)
    declarative-option (0.1.0)
    devise (4.3.0)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.2)
      responders
      warden (~> 1.2.3)
    devise_ldap_authenticatable (0.8.5)
      devise (>= 3.4.1)
      net-ldap (>= 0.6.0, <= 0.11)
    docx (0.2.07)
      nokogiri (~> 1.5)
      rubyzip (~> 1.1.6)
    erubi (1.7.0)
    erubis (2.7.0)
    exception_notification (4.2.2)
      actionmailer (>= 4.0, < 6)
      activesupport (>= 4.0, < 6)
    execjs (2.7.0)
    faraday (0.12.2)
      multipart-post (>= 1.2, < 3)
    ffi (1.9.18-x64-mingw32)
    ffi (1.9.18-x86-mingw32)
    flipper (0.11.0)
    flipper-ui (0.11.0)
      erubis (~> 2.7.0)
      flipper (~> 0.11.0)
      rack (>= 1.4, < 3)
      rack-protection (>= 1.5.3, < 2.1.0)
    globalid (0.4.1)
      activesupport (>= 4.2.0)
    gmail (0.6.0)
      gmail_xoauth (>= 0.3.0)
      mail (>= 2.2.1)
    gmail_xoauth (0.4.2)
      oauth (>= 0.3.6)
    google-api-client (0.17.3)
      addressable (~> 2.5, >= 2.5.1)
      googleauth (>= 0.5, < 0.7.0)
      httpclient (>= 2.8.1, < 3.0)
      mime-types (~> 3.0)
      representable (~> 3.0)
      retriable (>= 2.0, < 4.0)
    googleauth (0.6.2)
      faraday (~> 0.12)
      jwt (>= 1.4, < 3.0)
      logging (~> 2.0)
      memoist (~> 0.12)
      multi_json (~> 1.11)
      os (~> 0.9)
      signet (~> 0.7)
    googlecharts (1.6.12)
    hashie (3.5.6)
    htmlentities (4.3.4)
    httpclient (2.8.3)
    i18n (0.9.1)
      concurrent-ruby (~> 1.0)
    jwt (1.5.6)
    little-plugger (1.1.4)
    logging (2.2.2)
      little-plugger (~> 1.1)
      multi_json (~> 1.10)
    loofah (2.1.1)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.0)
      mini_mime (>= 0.1.1)
    memoist (0.16.0)
    method_source (0.9.0)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_mime (1.0.0)
    mini_portile2 (2.3.0)
    minitest (5.10.3)
    money (6.10.0)
      i18n (>= 0.6.4, < 1.0)
    multi_json (1.12.2)
    multi_logger (0.1.0)
      railties
    multi_xml (0.6.0)
    multipart-post (2.0.0)
    net-ldap (0.11)
    nio4r (2.1.0)
    nokogiri (1.8.1-x64-mingw32)
      mini_portile2 (~> 2.3.0)
    nokogiri (1.8.1-x86-mingw32)
      mini_portile2 (~> 2.3.0)
    oauth (0.5.3)
    oauth2 (1.4.0)
      faraday (>= 0.8, < 0.13)
      jwt (~> 1.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (>= 1.2, < 3)
    omniauth (1.7.1)
      hashie (>= 3.4.6, < 3.6.0)
      rack (>= 1.6.2, < 3)
    omniauth-oauth2 (1.4.0)
      oauth2 (~> 1.0)
      omniauth (~> 1.2)
    orm_adapter (0.5.0)
    os (0.9.6)
    public_suffix (3.0.1)
    puma (3.11.0)
    rack (2.0.3)
    rack-protection (2.0.0)
      rack
    rack-test (0.8.2)
      rack (>= 1.0, < 3)
    rails (5.1.4)
      actioncable (= 5.1.4)
      actionmailer (= 5.1.4)
      actionpack (= 5.1.4)
      actionview (= 5.1.4)
      activejob (= 5.1.4)
      activemodel (= 5.1.4)
      activerecord (= 5.1.4)
      activesupport (= 5.1.4)
      bundler (>= 1.3.0)
      railties (= 5.1.4)
      sprockets-rails (>= 2.0.0)
    rails-assets-fullcalendar (3.7.0)
      rails-assets-jquery (>= 2, < 4)
      rails-assets-moment (>= 2.9.0, < 3)
    rails-assets-fullcalendar-scheduler (1.9.0)
      rails-assets-fullcalendar (~> 3.7.0)
      rails-assets-jquery (>= 2, < 4)
      rails-assets-moment (>= 2.9.0, < 3)
    rails-assets-jquery (3.2.1)
    rails-assets-jquery-ui (1.12.1)
      rails-assets-jquery (>= 1.6)
    rails-assets-jquery-ujs (1.2.2)
      rails-assets-jquery (> 1.8)
    rails-assets-jqueryui-timepicker-addon (1.6.3)
    rails-assets-js-cookie (2.2.0)
    rails-assets-lightbox (2.10.0)
      rails-assets-jquery (> 2)
    rails-assets-moment (2.19.3)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (5.1.4)
      actionpack (= 5.1.4)
      activesupport (= 5.1.4)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.3.0)
    rb-fsevent (0.10.2)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    rchardet19 (1.3.7)
    representable (3.0.4)
      declarative (< 0.1.0)
      declarative-option (< 0.2.0)
      uber (< 0.2.0)
    responders (2.4.0)
      actionpack (>= 4.2.0, < 5.3)
      railties (>= 4.2.0, < 5.3)
    retriable (3.1.1)
    ruby-oci8 (2.2.5-x64-mingw32)
    ruby-oci8 (2.2.5-x86-mingw32)
    rubyzip (1.1.7)
    sass (3.5.3)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sass-rails (5.0.7)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    signet (0.8.1)
      addressable (~> 2.3)
      faraday (~> 0.9)
      jwt (>= 1.5, < 3.0)
      multi_json (~> 1.10)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.13-x64-mingw32)
    sqlite3 (1.3.13-x86-mingw32)
    thor (0.20.0)
    thread_safe (0.3.6)
    tilt (2.0.8)
    tiny_tds (2.1.0-x64-mingw32)
    tiny_tds (2.1.0-x86-mingw32)
    tzinfo (1.2.4)
      thread_safe (~> 0.1)
    tzinfo-data (1.2017.3)
      tzinfo (>= 1.0.0)
    uber (0.1.0)
    uglifier (3.2.0)
      execjs (>= 0.3.0, < 3)
    warden (1.2.7)
      rack (>= 1.0)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.3)
    zip (2.0.2)

PLATFORMS
  x64-mingw32
  x86-mingw32

DEPENDENCIES
  activerecord-sqlserver-adapter
  ar-octopus
  axlsx
  bootstrap-sass
  bootstrap_form
  byebug
  cmxl
  cocoon
  coffee-rails
  devise
  devise_ldap_authenticatable
  docx
  exception_notification
  flipper
  flipper-ui
  gmail
  google-api-client
  googleauth
  googlecharts
  money
  multi_logger
  omniauth-google-oauth2!
  puma
  rails
  rails-assets-fullcalendar!
  rails-assets-fullcalendar-scheduler!
  rails-assets-jquery!
  rails-assets-jquery-ui!
  rails-assets-jquery-ujs!
  rails-assets-jqueryui-timepicker-addon!
  rails-assets-js-cookie!
  rails-assets-lightbox!
  ruby-oci8
  sass-rails
  sqlite3
  tiny_tds
  tzinfo-data
  uglifier
  zip

BUNDLED WITH
   1.16.0
Run Code Online (Sandbox Code Playgroud)

这是我在nginx日志中看到的:

10.86.12.240 - - [27/Dec/2017:13:44:12 +0000] "GET / HTTP/2.0" 200 5589 "-" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
10.86.12.240 - - [27/Dec/2017:13:44:18 +0000] "GET /reports/3576 HTTP/2.0" 499 0 "https://quick.roche.com/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
10.86.12.240 - - [27/Dec/2017:13:44:19 +0000] "GET /reports/3576 HTTP/2.0" 200 7802 "https://quick.roche.com/" "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
Run Code Online (Sandbox Code Playgroud)

成功(http status = 200)请求初始页面,然后是499和200

499是什么让我在rails堆栈中出错

this is what I have in rails logs for those last two requests:

I, [2017-12-27T13:44:18.744420 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d] Started GET "/reports/3576" for 127.0.0.1 at 2017-12-27 13:44:18 +0000
I, [2017-12-27T13:44:18.744420 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d] Processing by ReportsController#show as HTML
I, [2017-12-27T13:44:18.744420 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Parameters: {"id"=>"3576"}
D, [2017-12-27T13:44:18.744420 #1760] DEBUG -- : [1226f679-086e-4699-a6de-cab43006d58d] [1m[32m[Shard: ir][0m  [1m[36mUser Load (0.0ms)[0m  [1m[35mEXEC sp_executesql N'SELECT  [users].* FROM [users] WHERE [users].[login] = @0  ORDER BY name ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY', N'@0 varchar(8), @1 int', @0 = 'sh', @1 = 1[0m  [["login", nil], ["LIMIT", nil]]
D, [2017-12-27T13:44:18.744420 #1760] DEBUG -- : [1226f679-086e-4699-a6de-cab43006d58d] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (0.0ms)[0m  [1m[35mEXEC Delegators @ToolName = N'WebT&E', @user = N'sh', @permission = N'% REPORT'[0m
I, [2017-12-27T13:44:18.869223 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502] Started GET "/reports/3576" for 127.0.0.1 at 2017-12-27 13:44:18 +0000
I, [2017-12-27T13:44:18.869223 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502] Processing by ReportsController#show as HTML
I, [2017-12-27T13:44:18.869223 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Parameters: {"id"=>"3576"}
D, [2017-12-27T13:44:18.869223 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mUser Load (0.0ms)[0m  [1m[35mEXEC sp_executesql N'SELECT  [users].* FROM [users] WHERE [users].[login] = @0  ORDER BY name ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY', N'@0 varchar(8), @1 int', @0 = 'sh', @1 = 1[0m  [["login", nil], ["LIMIT", nil]]
D, [2017-12-27T13:44:18.869223 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (0.0ms)[0m  [1m[35mEXEC Delegators @ToolName = N'WebT&E', @user = N'sh', @permission = N'% REPORT'[0m
D, [2017-12-27T13:44:19.212432 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (343.2ms)[0m  [1m[35mEXEC GetParameters @ToolName = N'WebT&E', @user = N'sh', @user_direct = N'sh', @report_id = N'3576'[0m
D, [2017-12-27T13:44:19.212432 #1760] DEBUG -- : [1226f679-086e-4699-a6de-cab43006d58d] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (468.0ms)[0m  [1m[35mEXEC GetParameters @ToolName = N'WebT&E', @user = N'sh', @user_direct = N'sh', @report_id = N'3576'[0m
D, [2017-12-27T13:44:19.212432 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mUser Load (0.0ms)[0m  [1m[35mEXEC sp_executesql N'SELECT  [users].* FROM [users] WHERE [users].[login] = @0  ORDER BY name ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY', N'@0 varchar(8), @1 int', @0 = 'mp', @1 = 1[0m  [["login", nil], ["LIMIT", nil]]
I, [2017-12-27T13:44:19.212432 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendering reports/show.html.erb within layouts/application
D, [2017-12-27T13:44:19.212432 #1760] DEBUG -- : [1226f679-086e-4699-a6de-cab43006d58d] [1m[32m[Shard: ir][0m  [1m[36mUser Load (0.0ms)[0m  [1m[35mEXEC sp_executesql N'SELECT  [users].* FROM [users] WHERE [users].[login] = @0  ORDER BY name ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY', N'@0 varchar(8), @1 int', @0 = 'mp', @1 = 1[0m  [["login", nil], ["LIMIT", nil]]
I, [2017-12-27T13:44:19.212432 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendering reports/show.html.erb within layouts/application
D, [2017-12-27T13:44:19.228033 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mComment Load (15.6ms)[0m  [1m[34mSELECT [comments].* FROM [comments] WHERE (entity='Report' AND entity_id=N'3576')[0m
D, [2017-12-27T13:44:19.228033 #1760] DEBUG -- : [1226f679-086e-4699-a6de-cab43006d58d] [1m[32m[Shard: ir][0m  [1m[36mComment Load (15.6ms)[0m  [1m[34mSELECT [comments].* FROM [comments] WHERE (entity='Report' AND entity_id=N'3576')[0m
I, [2017-12-27T13:44:19.243633 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered reports/_transactions.html.erb (15.6ms)
I, [2017-12-27T13:44:19.243633 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendered reports/_transactions.html.erb (15.6ms)
I, [2017-12-27T13:44:19.243633 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered reports/_summary.html.erb (31.2ms)
I, [2017-12-27T13:44:19.243633 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendered reports/_summary.html.erb (31.2ms)
I, [2017-12-27T13:44:19.243633 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered reports/show.html.erb within layouts/application (31.2ms)
I, [2017-12-27T13:44:19.243633 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d] Completed 500 Internal Server Error in 499ms (ActiveRecord: 483.6ms)
I, [2017-12-27T13:44:19.259233 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendering F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb
I, [2017-12-27T13:44:19.274834 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_request.text.erb (0.0ms)
D, [2017-12-27T13:44:19.274834 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (31.2ms)[0m  [1m[35mEXEC account_groups @user = N'mp'[0m
I, [2017-12-27T13:44:19.290434 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms)
I, [2017-12-27T13:44:19.290434 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_session.text.erb (0.0ms)
I, [2017-12-27T13:44:19.290434 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms)
I, [2017-12-27T13:44:19.306035 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_environment.text.erb (0.0ms)
D, [2017-12-27T13:44:19.306035 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (15.6ms)[0m  [1m[35mEXEC accounts_for @user = N'mp', @group = N'Travel'[0m
I, [2017-12-27T13:44:19.306035 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms)
I, [2017-12-27T13:44:19.306035 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_backtrace.text.erb (0.0ms)
I, [2017-12-27T13:44:19.306035 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms)
I, [2017-12-27T13:44:19.306035 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d]   Rendered F:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/exception_notification-4.2.2/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb (46.8ms)
D, [2017-12-27T13:44:19.306035 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (0.0ms)[0m  [1m[35mEXEC accounts_for @user = N'mp', @group = N'Congress'[0m
D, [2017-12-27T13:44:19.306035 #1760] DEBUG -- : [1226f679-086e-4699-a6de-cab43006d58d] #exception_notification: processed outbound mail in 62.4ms
D, [2017-12-27T13:44:19.321635 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (15.6ms)[0m  [1m[35mEXEC accounts_for @user = N'mp', @group = N'Other'[0m
D, [2017-12-27T13:44:19.399637 #1760] DEBUG -- : [9817073b-8d80-4516-ba8d-040e223d1502] [1m[32m[Shard: ir][0m  [1m[36mExecute Procedure (78.0ms)[0m  [1m[35mEXEC UnreportedRequests @ToolName = N'WebT&E', @user = N'mp', @ReportId = 3576[0m
I, [2017-12-27T13:44:19.399637 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendered reports/_transaction_dialog.html.erb (156.0ms)
I, [2017-12-27T13:44:19.399637 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendered reports/_split_dialog.html.erb (0.0ms)
I, [2017-12-27T13:44:19.399637 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendered reports/_travel_dialog.html.erb (0.0ms)
I, [2017-12-27T13:44:19.399637 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendered reports/_additionals_dialog.html.erb (0.0ms)
I, [2017-12-27T13:44:19.399637 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502]   Rendered reports/show.html.erb within layouts/application (187.2ms)
I, [2017-12-27T13:44:19.399637 #1760]  INFO -- : [9817073b-8d80-4516-ba8d-040e223d1502] Completed 200 OK in 530ms (Views: 36.4ms | ActiveRecord: 499.2ms)
I, [2017-12-27T13:44:19.477639 #1760]  INFO -- : [1226f679-086e-4699-a6de-cab43006d58d] Sent mail to krzysztof.chodak@... (171.6ms)
Run Code Online (Sandbox Code Playgroud)

It looks to me like there were two the same requests and one of them has failed with 'nested transaction' error from ActiveRecord (is it AR? class of the error actually is ActionView::Template::Error)...

I do not see any "nested transaction" in rails source...

First question is why there are two requests in rails from the same client and almost the same second?

Second question is why such parallel requests do fail?

I have searched all my gem sources for "nested transaction" and I do not see it - I am not able to locate the code raising this error :(

Kod*_*dak 0

我终于能够在开发中重现此错误:我双击一个链接,导致两个几乎同时发生的请求。实际的“嵌套事务”错误来自 Flipper 的 PStore。

解决方案:

  • 通过使用 $flipper.preload([]) 和功能名称数组并在 PStore 上添加 5 分钟 ActiveSupportCacheStore 缓存,减少 Flipper 功能调用的数量

  • 禁用连续链接的使用

有待检查它在生产中是否有效,但开发测试看起来很有希望。

更新 1:它只是减少错误数量 - PStore 上的线程安全选项需要通过修补 Flipper 来启用

更新2: https: //github.com/jnunemaker/flipper/pull/334