遇到一个 homeland 上传图片问题,看起来像是图片上传超时了,虽然文件大小只有 200 K。
网站使用的是阿里云 OSS,Access Token 配置正确。虽然上传失败,但通过阿里云的 Access Token 访问记录可以看到最后的访问时间。并且,8 天前还可以正常上传。
数据库操作记录:
异常详情:
execution expired
Method: POST
URL: /photos
Controller: photos#create
RequestId: 57b1e0a6-25b2-41fa-bf4c-93cffa6e5c19
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36
Remote IP: 172.23.0.8
Language: en,zh-CN;q=0.9,zh;q=0.8
Server: c13ba6dc1530
Process: 44
--------------------------------------------------
#<Net::OpenTimeout: execution expired>
/usr/local/lib/ruby/2.6.0/net/http.rb:947:in `initialize'
/usr/local/lib/ruby/2.6.0/net/http.rb:947:in `open'
/usr/local/lib/ruby/2.6.0/net/http.rb:947:in `block in connect'
/usr/local/lib/ruby/2.6.0/timeout.rb:103:in `timeout'
/usr/local/lib/ruby/2.6.0/net/http.rb:945:in `connect'
/usr/local/lib/ruby/2.6.0/net/http.rb:1548:in `begin_transport'
/usr/local/lib/ruby/2.6.0/net/http.rb:1505:in `transport_request'
/usr/local/lib/ruby/2.6.0/net/http.rb:1479:in `request'
/usr/local/lib/ruby/2.6.0/net/http.rb:1472:in `block in request'
/usr/local/lib/ruby/2.6.0/net/http.rb:920:in `start'
/usr/local/lib/ruby/2.6.0/net/http.rb:1470:in `request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/httparty-0.16.3/lib/httparty/request.rb:145:in `perform'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/httparty-0.16.3/lib/httparty.rb:573:in `perform_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/httparty-0.16.3/lib/httparty.rb:517:in `put'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/httparty-0.16.3/lib/httparty.rb:632:in `put'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/aliyun-oss-sdk-0.1.8/lib/aliyun/oss/http.rb:55:in `request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/aliyun-oss-sdk-0.1.8/lib/aliyun/oss/http.rb:22:in `put'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/aliyun-oss-sdk-0.1.8/lib/aliyun/oss/api/bucket_objects.rb:44:in `bucket_create_object'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-aliyun-0.9.0/lib/carrierwave/aliyun/bucket.rb:41:in `put'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-aliyun-0.9.0/lib/carrierwave/storage/aliyun_file.rb:49:in `store'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-aliyun-0.9.0/lib/carrierwave/storage/aliyun.rb:15:in `store!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/store.rb:66:in `block in store!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/callbacks.rb:15:in `with_callbacks'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-1.2.3/lib/carrierwave/uploader/store.rb:65:in `store!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-1.2.3/lib/carrierwave/mounter.rb:100:in `each'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-1.2.3/lib/carrierwave/mounter.rb:100:in `store!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/carrierwave-1.2.3/lib/carrierwave/mount.rb:395:in `store_image!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:426:in `block in make_lambda'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:236:in `block in halting_and_conditional'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:517:in `block in invoke_after'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:517:in `each'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:517:in `invoke_after'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:133:in `run_callbacks'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:816:in `_run_save_callbacks'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/callbacks.rb:342:in `create_or_update'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/persistence.rb:273:in `save'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/validations.rb:46:in `save'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/transactions.rb:310:in `block (2 levels) in save'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `block in transaction'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/usr/local/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `transaction'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/transactions.rb:212:in `transaction'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/transactions.rb:310:in `block in save'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/transactions.rb:325:in `rollback_active_record_state!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/transactions.rb:309:in `save'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/suppressor.rb:44:in `save'
/home/app/homeland/app/controllers/photos_controller.rb:16:in `create'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:132:in `run_callbacks'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/notifications.rb:168:in `instrument'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activerecord-5.2.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/abstract_controller/base.rb:134:in `process'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionview-5.2.2.1/lib/action_view/rendering.rb:32:in `process'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:190:in `call!'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/omniauth-1.8.1/lib/omniauth/strategy.rb:168:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/http_accept_language-2.1.1/lib/http_accept_language/middleware.rb:14:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-attack-5.4.2/lib/rack/attack.rb:182:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/exception_notification-4.3.0/lib/exception_notification/rack.rb:41:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/tempfile_reaper.rb:15:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/etag.rb:25:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/conditional_get.rb:38:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/head.rb:12:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:232:in `context'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/session/abstract/id.rb:226:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/rack/logger.rb:26:in `block in call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:28:in `tagged'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/tagged_logging.rb:71:in `tagged'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/rack/logger.rb:26:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/method_override.rb:22:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/runtime.rb:22:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-2.0.6/lib/rack/sendfile.rb:111:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/actionpack-5.2.2.1/lib/action_dispatch/middleware/ssl.rb:74:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-cors-1.0.2/lib/rack/cors.rb:97:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/rack-utf8_sanitizer-1.6.0/lib/rack/utf8_sanitizer.rb:22:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/railties-5.2.2.1/lib/rails/engine.rb:524:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
/home/app/homeland/vendor/bundle/ruby/2.6.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
另一个可能的 bug:
在后台管理 -> 图片
菜单的最底部,有一个New Photo
的链接,点进去之后是 404,链接地址为/admin/photos/new
。
请确认,十分感谢