{"action":"created","issue":{"url":"https://api.github.com/repos/mperham/sidekiq/issues/2502","labels_url":"https://api.github.com/repos/mperham/sidekiq/issues/2502/labels{/name}","comments_url":"https://api.github.com/repos/mperham/sidekiq/issues/2502/comments","events_url":"https://api.github.com/repos/mperham/sidekiq/issues/2502/events","html_url":"https://github.com/mperham/sidekiq/issues/2502","id":102212025,"number":2502,"title":"ActiveRecord::StatementInvalid: Errno::EBADF: Bad file descriptor","user":{"login":"wksmall","id":164522,"avatar_url":"https://avatars.githubusercontent.com/u/164522?v=3","gravatar_id":"","url":"https://api.github.com/users/wksmall","html_url":"https://github.com/wksmall","followers_url":"https://api.github.com/users/wksmall/followers","following_url":"https://api.github.com/users/wksmall/following{/other_user}","gists_url":"https://api.github.com/users/wksmall/gists{/gist_id}","starred_url":"https://api.github.com/users/wksmall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wksmall/subscriptions","organizations_url":"https://api.github.com/users/wksmall/orgs","repos_url":"https://api.github.com/users/wksmall/repos","events_url":"https://api.github.com/users/wksmall/events{/privacy}","received_events_url":"https://api.github.com/users/wksmall/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-20T19:10:09Z","updated_at":"2015-08-20T19:23:58Z","closed_at":"2015-08-20T19:23:58Z","body":"Lately we've been seeing a number of these errors which ultimately cause a sidekiq job to fail. There doesn't seem to be any pattern to the point where the error occurs. In other sidekiq issues, I read that we should be running the latest gems, particularly mysql2 which we updated last week. We are still seeing the error however. Our current configuration includes the following:\r\n```\r\nRails 3.2.22\r\nRuby 1.9.3\r\nGems:\r\n * sidekiq-failures (0.4.3)\r\n  * sidekiq-pro (1.5.1)\r\n  * sidekiq (2.17.7)\r\n  * sidekiq-status (0.5.0 84e2747)\r\n  * sidetiq (0.6.1)\r\n  * mysql2 (0.3.19)\r\n```\r\nYou will note, of course, that we are running an older version of sidekiq because we are still on Ruby 1.9.3. An upgrade to Ruby 2.2.2 is in QA and is due to be released within the next 2 weeks.\r\n\r\nHere is an example backtrace:\r\n```\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245 in query\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245 in block in execute\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:280 in block in log\r\n/gems/activesupport-3.2.22/lib/active_support/notifications/instrumenter.rb:20 in instrument\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:275 in log\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/instrumentation/active_record.rb:59 in block in log_with_newrelic_instrumentation\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/method_tracer.rb:73 in block in trace_execution_scoped\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/method_tracer_helpers.rb:82 in trace_execution_scoped\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/method_tracer.rb:71 in trace_execution_scoped\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/instrumentation/active_record.rb:56 in log_with_newrelic_instrumentation\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245 in execute\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/mysql2_adapter.rb:213 in execute\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/mysql2_adapter.rb:217 in exec_query\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/mysql2_adapter.rb:226 in select\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:18 in select_all\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/query_cache.rb:63 in select_all\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:24 in select_one\r\n/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:30 in select_value\r\n/gems/activerecord-3.2.22/lib/active_record/relation/calculations.rb:250 in execute_simple_calculation\r\n/gems/activerecord-3.2.22/lib/active_record/relation/calculations.rb:215 in perform_calculation\r\n/gems/activerecord-3.2.22/lib/active_record/relation/calculations.rb:159 in calculate\r\n/gems/activerecord-3.2.22/lib/active_record/relation/calculations.rb:58 in count\r\napp/models/gradebook/stale_assignments.rb:13 in stale_assignments_count\r\napp/models/gradebook/stale_assignments.rb:8 in any_stale_assignments?\r\napp/models/gradebook/updater.rb:42 in make_section_current\r\napp/models/gradebook/updater.rb:28 in block in make_all_courses_current\r\n/gems/activerecord-3.2.22/lib/active_record/relation/batches.rb:21 in block (2 levels) in find_each\r\n/gems/activerecord-3.2.22/lib/active_record/relation/batches.rb:21 in each\r\n/gems/activerecord-3.2.22/lib/active_record/relation/batches.rb:21 in block in find_each\r\n/gems/activerecord-3.2.22/lib/active_record/relation/batches.rb:72 in find_in_batches\r\n/gems/activerecord-3.2.22/lib/active_record/relation/batches.rb:20 in find_each\r\napp/models/gradebook/updater.rb:27 in make_all_courses_current\r\napp/workers/gradebook_updater_worker.rb:13 in block in perform\r\napp/workers/worker_instrumentation.rb:6 in time_and_log\r\napp/workers/gradebook_updater_worker.rb:13 in perform\r\n/gems/sidekiq-2.17.7/lib/sidekiq/processor.rb:49 in block (3 levels) in process\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:122 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:122 in block in invoke\r\n/gems/statsd-ruby-1.2.1/lib/statsd.rb:232 in time\r\nlib/patches/sidekiq/middleware/server/statsd.rb:33 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\nlib/sidekiq/persistence/server_middleware.rb:12 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n[GEM_ROOT]/bundler/gems/sidekiq-status-84e2747a9b10/lib/sidekiq-status/server_middleware.rb:37 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/instrumentation/sidekiq.rb:33 in block in call\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:361 in perform_action_with_newrelic_trace\r\n/gems/newrelic_rpm-3.12.1.298/lib/new_relic/agent/instrumentation/sidekiq.rb:29 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/sidetiq-0.6.1/lib/sidetiq/middleware/history.rb:17 in call_with_sidetiq_history\r\n/gems/sidetiq-0.6.1/lib/sidetiq/middleware/history.rb:6 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/sidekiq-pro-1.5.1/lib/sidekiq/batch/middleware.rb:26 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/server/active_record.rb:6 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/server/retry_jobs.rb:62 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/sidekiq-failures-0.4.3/lib/sidekiq/failures/middleware.rb:9 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/server/logging.rb:11 in block in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/logging.rb:22 in with_context\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/server/logging.rb:7 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:124 in block in invoke\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:127 in call\r\n/gems/sidekiq-2.17.7/lib/sidekiq/middleware/chain.rb:127 in invoke\r\n/gems/sidekiq-2.17.7/lib/sidekiq/processor.rb:48 in block (2 levels) in process\r\n/gems/sidekiq-2.17.7/lib/sidekiq/processor.rb:108 in stats\r\n/gems/sidekiq-2.17.7/lib/sidekiq/processor.rb:47 in block in process\r\n/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25 in call\r\n/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25 in public_send\r\n/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25 in dispatch\r\n/gems/celluloid-0.15.2/lib/celluloid/calls.rb:67 in dispatch\r\n/gems/celluloid-0.15.2/lib/celluloid/future.rb:14 in block in new\r\n/gems/celluloid-0.15.2/lib/celluloid/thread_handle.rb:13 in block in initialize\r\n/gems/celluloid-0.15.2/lib/celluloid/internal_pool.rb:100 in call\r\n/gems/celluloid-0.15.2/lib/celluloid/internal_pool.rb:100 in block in create\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/mperham/sidekiq/issues/comments/133137181","html_url":"https://github.com/mperham/sidekiq/issues/2502#issuecomment-133137181","issue_url":"https://api.github.com/repos/mperham/sidekiq/issues/2502","id":133137181,"user":{"login":"mperham","id":2911,"avatar_url":"https://avatars.githubusercontent.com/u/2911?v=3","gravatar_id":"","url":"https://api.github.com/users/mperham","html_url":"https://github.com/mperham","followers_url":"https://api.github.com/users/mperham/followers","following_url":"https://api.github.com/users/mperham/following{/other_user}","gists_url":"https://api.github.com/users/mperham/gists{/gist_id}","starred_url":"https://api.github.com/users/mperham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mperham/subscriptions","organizations_url":"https://api.github.com/users/mperham/orgs","repos_url":"https://api.github.com/users/mperham/repos","events_url":"https://api.github.com/users/mperham/events{/privacy}","received_events_url":"https://api.github.com/users/mperham/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T19:23:58Z","updated_at":"2015-08-20T19:23:58Z","body":"Looks like a dupe of #1945, bug is being tracked in brianmario/mysql2#547."}}