- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 resque 工作中遇到了一个奇怪的问题,我想知道是否有其他人遇到过。
我们在 jruby 1.6.2 下运行 resque
我们有一个长时间 运行任务,它从各种 URL 下载一堆文件,使用 Fog 将这些文件上传到 Rackspace Cloudfiles,然后将有关这些文件的一些信息存储在 MySQL 中。在这种情况持续一段时间后,我们应用程序的网络堆栈似乎崩溃了。在一个例子中,失败的第一个迹象是从这里超时:
org/jruby/ext/openssl/SSLSocket.java:512:in `sysread'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/jruby-openssl-0.7.4/lib/openssl/buffering.rb:35:in `fill_rbuff'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/jruby-openssl-0.7.4/lib/openssl/buffering.rb:158:in `eof?'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/jruby-openssl-0.7.4/lib/openssl/buffering.rb:133:in `readline'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/excon-0.6.5/lib/excon/response.rb:22:in `parse'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/excon-0.6.5/lib/excon/connection.rb:174:in `request'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/fog-0.11.0/lib/fog/core/connection.rb:20:in `request'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/fog-0.11.0/lib/fog/storage/rackspace.rb:107:in `request'
我们通常会在作业运行 10-15 分钟后开始看到这些问题。之后,我们开始在每次后续尝试写入数据库时看到这一点......
ActiveRecord::JDBCError: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.: SELECT `bills`.* FROM `bills` WHERE (`bills`.state_session_id = 59)
ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.: SELECT `bills`.* FROM `bills` WHERE (`bills`.state_session_id = 59)
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:207:in `log'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-jdbc-adapter-1.1.1/lib/arjdbc/jdbc/adapter.rb:183:in `execute'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-jdbc-adapter-1.1.1/lib/arjdbc/jdbc/adapter.rb:275:in `select'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/query_cache.rb:56:in `select_all'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-3.0.10/lib/active_record/base.rb:473:in `find_by_sql'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-3.0.10/lib/active_record/relation.rb:64:in `to_a'
/var/www/lisausa/shared/bundle/jruby/1.9/gems/activerecord-3.0.10/lib/active_record/relation/finder_methods.rb:143:in `all'
我尝试使用 ruby-cloudfiles gem 而不是 Fog,但我们似乎开始遇到完全相同的错误,最终也使用该组合。如果我禁用其中的文件下载/cloudfiles 上传部分,这些错误将永远不会出现,并且我已经能够让这个特定的作业运行数天。
关于这里可能发生的事情有什么理论吗?
最佳答案
不管怎样,几个月后,我可以告诉你
“ActiveRecord::JDBCError:无法从服务器读取响应。预期读取 4 个字节,但在连接意外丢失之前读取了 0 个字节...”
通常是我们的一个指示器,表明数据库连接已断开(由于网络问题或数据库出现故障等)并且底层套接字已关闭。至少对我们来说,JRuby/ActiveRecord/ConnectionPool 的默认行为是在每个命令上都出现此错误,而不是重新连接。
关于mysql - Jruby/Resque : Network connections from resque job begin failing repeatedly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7324365/
我用coffee-resque创建了一些worker,并尝试使用resque-web的ruby版本查看worker,但只看到间歇性的worker闪进闪出。 我注意到咖啡风格在暂停时会取消对 worke
假设这是我的 worker : class FooWorker @queue = :foo def self.perform User.all.each do |u| ..
我对 resque 很陌生,但它看起来非常适合我的需求。 实际上,我正在尝试设置一个简单的测试应用程序,例如: require 'resque' require 'resque/job_with_st
我正在使用 Resque 和 Resque 调度程序,但是当我输入命令时 resque-web它没有运行。而是提示错误: bash: resque-web: command not found So
我正在使用 ruby on rails 构建一个 webapp,它需要在后台运行 C++ exe 程序。我为此比较了 3 个最常用的 gem(Delayed_Jobs、Resque、Sidekiq
我想知道 resque-scheduler 是否需要一个 resque 实例来运行特定队列中的作业,或者 resque-scheduler 必须使用 resque:work 任务。 提前致谢。 最佳答
我正在使用 Resque、Resque-Status 和 Resque-Retry 来处理 bkg 作业。以下是一个示例作业。它针对 4-5 个模型执行查询。现在我想尝试使用 Sidekiq它以其超过
我正在开发一个使用 resque 的 rails 应用程序和 resque-scheduler 安排电子邮件发送。 有没有办法获得所有预定作业的列表,或者更好的具有特定参数的作业列表? 我尝试了一些类
将 Resque 与 Redis 结合使用 我一直收到 Redis 的 OOM 命令在使用内存时不允许 > 'maxmemory' 错误。现在很明显,我似乎应该将 redis 的内存从当前的 500M
此外,管理内置“管理结构”(如标题中的结构)的 Resque 的最佳实践是什么?我应该用 jedis.del(String key) 或类似的东西清除它们吗? 最佳答案 resque:failed 是
我有 resque-scheduler 在 Rails 应用程序中运行良好。现在我需要能够从队列中跟踪状态并删除作业。我简要地查看了 resque-status,据我所见,如果我能让它与 resque
我都关注了 instructions on resque-scheduler repo在 resque-web 界面上显示“延迟”和“计划”选项卡,但什么也没有! 这是进口的 gem : gem 'r
我已经为我的应用程序设置了 Resque.redis.namespace,现在 resque-web 不再显示工作人员和队列。 有什么方法可以让 resque-web 知道 redis.namespa
我一直试图让 Resque(使用 Resque 服务器)和 RedisToGo 在 heroku(cedar)上工作一段时间,但我一直遇到这个错误: Redis::CannotConnectError
我在 resque 工作中遇到了一个奇怪的问题,我想知道是否有其他人遇到过。 我们在 jruby 1.6.2 下运行 resque 我们有一个长时间 运行任务,它从各种 URL 下载一堆文件,使用 F
我刚刚看了这个关于 Resque 的惊人的 railscast .在我启动 redis 服务器并启动 workers 之后: rake environment resque:work QUEUE="*
我使用 resque-history 插件来监控已完成的任务。 首先,我将这个字符串 require 'resque-history/server' 包含到路由文件中,然后我在仪表板中看到了新的历史记
我需要启动 4 个 resque 工作人员,所以我使用了以下命令 bundle exec rake environment resque:workers RAILS_ENV=production CO
我有几个 Resque 作业在运行,每个都在一个单独的终端窗口中启动,如下所示: QUEUE=queue_1 rake environment resque:work QUEUE=queue_2 ra
我有以下代码。它的工作是根据通过浏览器(使用 Sinatra)提供的数据发送电子邮件。它会在 20 秒后向给定的地址发送一封电子邮件。当我运行该程序时,它会立即发送电子邮件,而无需等待时间。谁能帮我解
我是一名优秀的程序员,十分优秀!