我有一个使用Paperclip在RackSpace CloudFiles上存储图像的应用程序。 它一直运行良好,但最近不会保存文件。 发生的错误是:

Excon::Errors::SocketError (Connection timed out - connect(2) for 94.236.107.224:443 (Errno::ETIMEDOUT)):

excon/socket.rb我添加了一些调试功能,以在发出请求时查看@data的内容。 这是:

{
  :chunk_size        => 1048576, 
  :ciphers           => "HIGH:!SSLv2:!aNULL:!eNULL:!3DES", 
  :connect_timeout   => 60, 
  :debug_request     => false, 
  :debug_response    => true, 
  :headers           => {"User-Agent" => "fog/1.22.0"}, 
  :idempotent        => false, 
  :instrumentor_name => "excon", 
  :middlewares       => [Excon::Middleware::ResponseParser, Excon::Middleware::Expects, Excon::Middleware::Idempotent, Excon::Middleware::Instrumentor, Excon::Middleware::Mock],
  :mock              => false,
  :nonblock          => true,
  :omit_default_port => false,
  :persistent        => false,
  :read_timeout      => 60,
  :retry_limit       => 4,
  :ssl_verify_peer   => true,
  :tcp_nodelay       => false,
  :uri_parser        => URI,
  :write_timeout     => 60,
  :host              => "lon.auth.api.rackspacecloud.com",
  :path              => "/v2.0",
  :port              => 443,
  :query             => nil,
  :scheme            => "https",
  :user              => nil,
  :password          => nil
}

主机是lon.auth.api.rackspacecloud.com ,解析为92.52.64.197 (在服务器上以及在本地)。

但是,该错误是因为与94.236.107.224的连接超时。 在该IP上的反向查找显示该IP也与auth主机名相关联:

$ host 94.236.107.224
224.107.236.94.in-addr.arpa domain name pointer lon.auth.api.rackspacecloud.com.

我认为该IP不再用于auth服务,但是我根本看不到为什么要连接它。

所以我需要知道:

  1. 当错误IP未显示在日志中时,为什么连接到该IP?
  2. 如何解决此问题,以便使用正确的服务器?

这是发生的完整错误:

Completed 500 Internal Server Error in 15437.6ms

Excon::Errors::SocketError (Connection timed out - connect(2) for 94.236.107.224:443 (Errno::ETIMEDOUT)):
  excon (0.33.0) lib/excon/socket.rb:220:in `connect_nonblock'
  excon (0.33.0) lib/excon/socket.rb:220:in `rescue in block in connect'
  excon (0.33.0) lib/excon/socket.rb:189:in `block in connect'
  excon (0.33.0) lib/excon/socket.rb:185:in `each'
  excon (0.33.0) lib/excon/socket.rb:185:in `connect'
  excon (0.33.0) lib/excon/ssl_socket.rb:131:in `connect'
  excon (0.33.0) lib/excon/socket.rb:28:in `initialize'
  excon (0.33.0) lib/excon/ssl_socket.rb:9:in `initialize'
  excon (0.33.0) lib/excon/connection.rb:414:in `new'
  excon (0.33.0) lib/excon/connection.rb:414:in `socket'
  excon (0.33.0) lib/excon/connection.rb:126:in `request_call'
  excon (0.33.0) lib/excon/middlewares/mock.rb:42:in `request_call'
  excon (0.33.0) lib/excon/middlewares/instrumentor.rb:22:in `request_call'
  excon (0.33.0) lib/excon/middlewares/base.rb:15:in `request_call'
  excon (0.33.0) lib/excon/middlewares/base.rb:15:in `request_call'
  excon (0.33.0) lib/excon/middlewares/base.rb:15:in `request_call'
  excon (0.33.0) lib/excon/connection.rb:269:in `request'
  fog-core (1.22.0) lib/fog/core/connection.rb:56:in `request'
  fog (1.22.0) lib/fog/rackspace/service.rb:34:in `request_without_retry'
  fog (1.22.0) lib/fog/rackspace/requests/identity/create_token.rb:15:in `create_token'
  fog (1.22.0) lib/fog/rackspace/identity.rb:41:in `authenticate'
  fog (1.22.0) lib/fog/rackspace/identity.rb:79:in `initialize'
  fog-core (1.22.0) lib/fog/core/service.rb:115:in `new'
  fog-core (1.22.0) lib/fog/core/service.rb:115:in `new'
  fog (1.22.0) lib/fog/rackspace/service.rb:116:in `authenticate_v2'
  fog (1.22.0) lib/fog/rackspace/service.rb:30:in `authenticate'
  fog (1.22.0) lib/fog/rackspace/storage.rb:88:in `authenticate'
  fog (1.22.0) lib/fog/rackspace/storage.rb:419:in `initialize'
  fog-core (1.22.0) lib/fog/core/service.rb:115:in `new'
  fog-core (1.22.0) lib/fog/core/service.rb:115:in `new'
  fog-core (1.22.0) lib/fog/storage.rb:26:in `new'
  paperclip (3.4.2) lib/paperclip/storage/fog.rb:208:in `connection'
  paperclip (3.4.2) lib/paperclip/storage/fog.rb:218:in `directory'
  paperclip (3.4.2) lib/paperclip/storage/fog.rb:100:in `block in flush_writes'
  paperclip (3.4.2) lib/paperclip/storage/fog.rb:96:in `each'
  paperclip (3.4.2) lib/paperclip/storage/fog.rb:96:in `flush_writes'
  paperclip (3.4.2) lib/paperclip/attachment.rb:221:in `save'
  paperclip (3.4.2) lib/paperclip/instance_methods.rb:17:in `block in save_attached_files'
  paperclip (3.4.2) lib/paperclip/instance_methods.rb:10:in `block in each_attachment'
  paperclip (3.4.2) lib/paperclip/instance_methods.rb:9:in `each'
  paperclip (3.4.2) lib/paperclip/instance_methods.rb:9:in `each_attachment'
  paperclip (3.4.2) lib/paperclip/instance_methods.rb:16:in `save_attached_files'
  activesupport (3.2.17) lib/active_support/callbacks.rb:449:in `_run__806665839013247154__save__3701132647492051879__callbacks'
  activesupport (3.2.17) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.17) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
  activesupport (3.2.17) lib/active_support/callbacks.rb:81:in `run_callbacks'
  activerecord (3.2.17) lib/active_record/callbacks.rb:264:in `create_or_update'
  activerecord (3.2.17) lib/active_record/persistence.rb:84:in `save'
  activerecord (3.2.17) lib/active_record/validations.rb:50:in `save'
  activerecord (3.2.17) lib/active_record/attribute_methods/dirty.rb:22:in `save'
  activerecord (3.2.17) lib/active_record/transactions.rb:259:in `block (2 levels) in save'
  activerecord (3.2.17) lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
  activerecord (3.2.17) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
  activerecord (3.2.17) lib/active_record/transactions.rb:208:in `transaction'
  activerecord (3.2.17) lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
  activerecord (3.2.17) lib/active_record/transactions.rb:259:in `block in save'
  activerecord (3.2.17) lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
  activerecord (3.2.17) lib/active_record/transactions.rb:258:in `save'
  activeadmin (0.5.1) lib/active_admin/resource_controller/callbacks.rb:28:in `block in save_resource'
  activeadmin (0.5.1) lib/active_admin/callbacks.rb:78:in `run_save_callbacks'
  activeadmin (0.5.1) lib/active_admin/resource_controller/callbacks.rb:27:in `save_resource'
  activeadmin (0.5.1) lib/active_admin/resource_controller/callbacks.rb:22:in `block in create_resource'
  activeadmin (0.5.1) lib/active_admin/callbacks.rb:78:in `run_create_callbacks'
  activeadmin (0.5.1) lib/active_admin/resource_controller/callbacks.rb:21:in `create_resource'
  inherited_resources (1.4.1) lib/inherited_resources/actions.rb:33:in `create'
  activeadmin (0.5.1) lib/active_admin/resource_controller/actions.rb:48:in `create'
  actionpack (3.2.17) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.17) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.17) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.17) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.17) lib/active_support/callbacks.rb:458:in `_run__2901337515923689909__process_action__4396305873998292606__callbacks'
  activesupport (3.2.17) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.17) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.17) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.17) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.17) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.17) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.17) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.17) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.17) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.17) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.17) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.17) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.17) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.17) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.17) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.17) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.17) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.17) lib/action_dispatch/routing/route_set.rb:608:in `call'
  rack-google_analytics (1.0.2) lib/rack/google_analytics.rb:5:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `catch'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.5) lib/rack/etag.rb:23:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:35:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  activerecord (3.2.17) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.17) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.17) lib/active_support/callbacks.rb:405:in `_run__1208023080139519486__call__3701132647492051879__callbacks'
  activesupport (3.2.17) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.17) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.17) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.17) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.17) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.17) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.17) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.17) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.17) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.17) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:143:in `pass'
  rack-cache (1.2) lib/rack/cache/context.rb:155:in `invalidate'
  rack-cache (1.2) lib/rack/cache/context.rb:71:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.17) lib/rails/engine.rb:484:in `call'
  railties (3.2.17) lib/rails/application.rb:231:in `call'
  railties (3.2.17) lib/rails/railtie/configurable.rb:30:in `method_missing'
  /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/passenger-4.0.35/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
  /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/passenger-4.0.35/lib/phusion_passenger/request_handler/thread_handler.rb:142:in `accept_and_process_next_request'
  /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/passenger-4.0.35/lib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
  /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/passenger-4.0.35/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

===============>>#1 票数:2

我能够针对lon.auth.api.rackspacecloud.com成功进行身份验证。 我的猜测是DNS配置可能有问题。 让我跟踪某人来为您调查此问题。

凯尔

===============>>#2 票数:2 已采纳

感谢@ geemus,@ Kyle-Rames和@AshWilson提供了有关此难题的线索。

RS支持人员告诉我将身份验证服务器更改为lon.identity.api.rackspacecloud.com ,但是我看到了以下错误:

Unknown region :dfw for service cloudFiles. Please use one of the following regions: :lon

与设定区域rackspace_region: :lonpaperclip_defaults.rb排序时,和得到的东西再工作。

===============>>#3 票数:1

我不确定会导致这种情况的Rackspace方面的细节。 在激子中,ip的解析发生在Excon::Socket#connect 不知道您对这些事情的本质有多少了解,但想想我至少会指出您的方向,以防可能有所帮助: https : //github.com/geemus/excon/blob/master/lib/ EXCON / socket.rb#L167

至少目前至少还停留在套接字级别(我们只在套接字连接中查找过一次,并且不将其传播到数据哈希中)。 不过,您不必覆盖它(至少以我的经验,默认行为是正确的选择)。 我可能会建议此时针对雾将问题提交到github( https://github.com/fog/fog/issues/new ),以便我可以向Rackspace的人员指出。

  ask by Colin translate from so

未解决问题?本站智能推荐:

1回复

使用带有回形针的机架空间云文件(EU)使用雾

我很卡认证用曲别针和雾 欧洲Rackspace的云 。 我还在凭证中添加了这一行: 但这并没有改变任何事情。 它仍然试图通过美国云进行身份验证。 有谁有这个并运行? 提前致谢!
2回复

带有专用CDN的Rails +回形针+ Rackspace CloudFiles

我有一个使用Paperclip处理上传文件的Rails应用程序,我们目前由Rackspace托管。 该应用程序当前托管在单个服务器上,我正在使用负载平衡器,应用程序服务器和单独的数据库服务器构建一个更具可扩展性的解决方案。 我需要做的最后一件事是为上载的资产提供解决方案。 我曾尝试使用
2回复

用回形针和雾上传到Rackspace云文件

无法弄清楚该怎么做? 在其他任何地方都找不到太多帮助! 我像这样设置了回形针和雾; 配置/初始化/ fog.rb environment.rb中; 我正在使用file_field获取图像,然后将其发布到我的控制器。 这使我有了类似的东西; 我不明白的是,我
1回复

asset_sync / fog无法验证SSL证书

我想使用asset_sync gem在本地编译我的Rails资产,然后将它们上传到我的S3存储桶。 但是,当我尝试编译并上传它们时,rake任务将中止,因为它无法验证SSL证书。 我花了3天的时间寻找解决此问题的解决方法,但没有任何解决方法。 发现rubyinstaller.org
1回复

使用Fog和Carrierwave删除多个文件(版本)-Rackspace

我正在构建一个应用程序,其中有一个包含原始,中型和缩略图尺寸图像的文件。 我正在使用载波来完成此操作,并且需要从Rackspace Cloud Files中删除该文件的所有版本: 但是,当我通过控制台执行销毁操作时,它只是删除原始版本...如何删除所有版本? 我也在控制台中收到此错误
1回复

将RackSpace云文件与Paperclip gem一起使用

我已经通过回形针成功地将图像上传到RackSpace云文件存储,当我使用CDN网址时,它们可以正确显示在后续网页中。 但是,如果我不使用启用CDN的云文件,我无法弄清楚为什么Paperclip不显示文件。 回形针(通过附件的“ url”方法)返回更常用的/attachments/fred
1回复

如何使用rake任务将图像上传到Rackspace Cloud Files?

我正在尝试将Rackspace Cloud Files与Fog / Carrierwave /一起使用。 我的生产服务器中有一堆上传的图像。 我正在尝试使用以下rake任务将这些图像上传到Rackspace Cloud Files。 但是我收到以下错误: 这意味着图像未存储在
1回复

Paperclip,fog.io和Rackspace

我正在尝试找到有关如何设置Paperclip使用fog.io和fog.io来使用Rackspace Cloud File的文档,但我找不到任何好的参考(我认为自己是一个很好的Google语言扬声器:D )。 理想的情况是我可以将本地存储用于开发环境,使用Rackspace进行生产。 任何
1回复

使用回形针,雾气和机架空间上传图像

我需要使用雾和回形针将徽标图像上传到机架。 我在config / initializers / paperclip_defaults.rb中有此设置 但是如何初始化徽标以捕获这些设置。 请帮助我,我在这里感到困惑。
1回复

如果在Rackspace Cloudfiles中删除了图像,则会出现默认图像?

疯狂的问题,但是我需要/希望有能力显示替换图像,使用相同的URL到cloudfiles图像,以防找不到实际图像。 因此,在某人博客上的img标签中,它将指向我托管的图像。 如果实际的图像不存在了,我想显示另一幅图像,而不是显示浏览器所做的烦人的带边框的img文件。 在使用回形针的滑