0

キュウリを使ったDelayedJobによるメール送信をテストしようとしています。この機能は実際にはブラウザ(開発環境と本番環境の両方)で機能しますが、テストしようとすると奇妙なSQlite3例外が発生します。

テストログは下部にあります。ご覧のとおりSQLite3::SQLException、メール送信ジョブをキューに挿入した直後で失敗します。

Delayed :: Jobによると、失敗の理由は次のとおりです。

Delayed::DeserializationError
    /Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/psych_ext.rb:108:in `rescue in visit_Psych_Nodes_Mapping_with_class'

誰かがここで何が起こっているのか分かりましたか?

関連する質問を見つけましたが、そこでの問題はテスト環境に限定されているようには見えません。したがって、解決策は同じではないと思います。

  1. SQLite3エラー-ロールバックできません-アクティブなトランザクションはありません

完全なテストトレースは次のとおりです。

  SQL (82.7ms)  INSERT INTO "delayed_jobs" ("attempts", "created_at", "failed_at", "handler", "last_error", "locked_at", "locked_by", "priority", "queue", "run_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["attempts", 0], ["created_at", Tue, 08 May 2012 12:14:15 UTC +00:00], ["failed_at", nil], ["handler", "--- !ruby/object:Delayed::PerformableMailer\nobject: !ruby/class 'InvitationMailer'\nmethod_name: :invite\nargs:\n- !ruby/ActiveRecord:Invitation\n  attributes:\n    id: 1\n    sender_id: 1\n    search_id: 1\n    token: 4cba1a8a36de826493b1d8a8cc21091e2fb393e1\n    sent_at: \n    recipient_email: peter@example.com\n    created_at: 2012-05-08 12:14:15.702071000 Z\n    updated_at: 2012-05-08 12:14:15.702071000 Z\n    recipient_id: \n    accepted: \n"], ["last_error", nil], ["locked_at", nil], ["locked_by", nil], ["priority", 0], ["queue", nil], ["run_at", Tue, 08 May 2012 12:14:15 UTC +00:00], ["updated_at", Tue, 08 May 2012 12:14:15 UTC +00:00]]
   (0.9ms)  commit transaction
SQLite3::SQLException: cannot commit - no transaction is active: commit transaction
   (0.5ms)  rollback transaction
SQLite3::SQLException: cannot rollback - no transaction is active: rollback transaction
Completed 500 Internal Server Error in 126ms
  SQL (1.9ms)  UPDATE "delayed_jobs" SET locked_at = '2012-05-08 12:14:16.993126', locked_by = 'host:dtmbp.local pid:14059' WHERE (id = 3 and (locked_at is null or locked_at < '2012-05-08 08:14:16.993126') and (run_at <= '2012-05-08 12:14:16.993126'))
  Invitation Load (0.2ms)  SELECT "invitations".* FROM "invitations" WHERE "invitations"."id" = ? LIMIT 1  [["id", 1]]
  Invitation Load (0.1ms)  SELECT "invitations".* FROM "invitations" WHERE "invitations"."id" = ? LIMIT 1  [["id", 1]]
  Invitation Load (0.1ms)  SELECT "invitations".* FROM "invitations" WHERE "invitations"."id" = ? LIMIT 1  [["id", 1]]
  Invitation Load (0.1ms)  SELECT "invitations".* FROM "invitations" WHERE "invitations"."id" = ? LIMIT 1  [["id", 1]]
  Invitation Load (0.1ms)  SELECT "invitations".* FROM "invitations" WHERE "invitations"."id" = ? LIMIT 1  [["id", 1]]
   (0.1ms)  begin transaction
   (0.5ms)  UPDATE "delayed_jobs" SET "locked_at" = '2012-05-08 12:14:16.993126', "locked_by" = 'host:dtmbp.local pid:14059', "last_error" = '{Delayed::DeserializationError
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/psych_ext.rb:108:in `rescue in visit_Psych_Nodes_Mapping_with_class''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/psych_ext.rb:101:in `visit_Psych_Nodes_Mapping_with_class''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:134:in `block in visit_Psych_Nodes_Sequence''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:134:in `each''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:134:in `visit_Psych_Nodes_Sequence''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:276:in `block in revive''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:276:in `map''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:276:in `revive''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:219:in `visit_Psych_Nodes_Mapping''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/psych_ext.rb:119:in `visit_Psych_Nodes_Mapping_with_class''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:231:in `visit_Psych_Nodes_Document''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:20:in `accept''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych/nodes/node.rb:35:in `to_ruby''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:128:in `load''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:84:in `payload_object''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:94:in `block in invoke_job''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/backend/base.rb:91:in `invoke_job''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:178:in `block (2 levels) in run''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/timeout.rb:68:in `timeout''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:178:in `block in run''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:295:in `realtime''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:177:in `run''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:234:in `block in reserve_and_run_one_job''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:234:in `reserve_and_run_one_job''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:162:in `block in work_off''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:161:in `times''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:161:in `work_off''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:133:in `block (4 levels) in start''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:295:in `realtime''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:132:in `block (3 levels) in start''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:129:in `block (2 levels) in start''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:128:in `loop''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:128:in `block in start''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/plugins/clear_locks.rb:7:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:60:in `block in initialize''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:78:in `block in add''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:65:in `execute''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/lifecycle.rb:38:in `run_callbacks''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/worker.rb:127:in `start''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/gems/delayed_job-3.0.2/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain''
/Users/davidtuite/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `load''
/Users/davidtuite/.rvm/gems/ruby-1.9.3-p194/bin/rake:19:in `<main>''', "failed_at" = '2012-05-08 12:14:17.131476', "updated_at" = '2012-05-08 12:14:17.132975' WHERE "delayed_jobs"."id" = 3
   (1.5ms)  commit transaction
4

1 に答える 1

0

このエラーが発生したばかりで、問題の AR オブジェクトが既に削除されていることに気付きました。もしかしてあなたもそうなの?

関連リンク: psych_ext.rb#L101 は、削除されたシリアライズされたオブジェクトの復元を中断します

于 2012-08-17T20:36:47.750 に答える