Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails ActiveStorage::FileNotFoundError但该文件实际存在_Ruby On Rails_Puma_Rails Activestorage - Fatal编程技术网

Ruby on rails ActiveStorage::FileNotFoundError但该文件实际存在

Ruby on rails ActiveStorage::FileNotFoundError但该文件实际存在,ruby-on-rails,puma,rails-activestorage,Ruby On Rails,Puma,Rails Activestorage,我正在开发Rails 6.0.21应用程序(ruby 2.5.5),并使用puma 3.12.2作为开发web服务器和带有本地磁盘服务的ActiveStorage 我的应用程序不时会出现错误,并出现ActiveStorage::FileNotFoundError。实际文件存在于磁盘上。模型正确响应。附件 重启puma解决了这个问题,之后它又会随机出现……有些天比其他天更频繁。 这在Apache上发生,mod_乘客也是这样 我做错什么了吗 稍后编辑:下面是我对puma、活动存储和错误的标准配置 A

我正在开发Rails 6.0.21应用程序(ruby 2.5.5),并使用puma 3.12.2作为开发web服务器和带有本地磁盘服务的ActiveStorage

我的应用程序不时会出现错误,并出现
ActiveStorage::FileNotFoundError
。实际文件存在于磁盘上。模型正确响应。附件

重启puma解决了这个问题,之后它又会随机出现……有些天比其他天更频繁。 这在Apache上发生,mod_乘客也是这样

我做错什么了吗

稍后编辑:下面是我对puma、活动存储和错误的标准配置

ActiveStorage配置

development:
  service: Disk
  root: <%= Rails.root.join("storage") %>
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port        ENV.fetch("PORT") { 3000 }

# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }

# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }

# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
错误输出

ActionView::Template::Error (ActiveStorage::FileNotFoundError):
    2:     TODO cache this like forever
    3: -->
    4: <% if (current_website.icon.attached? rescue nil) %>
    5:     <link rel="apple-touch-icon" href="<%= current_website.icon.variant(resize: "57x57").service_url %>" />
    6:     <link rel="shortcut icon" href="<%= current_website.icon.variant(resize: "16x16").service_url %>" />
    7:     <link rel="icon" href="<%= current_website.icon.variant(resize: "16x16").service_url %>" />
    8:

app/views/common/_page_head_icons.html.erb:5
app/views/common/_page_head.html.erb:61
app/views/layouts/admin.html.erb:3
ActionView::Template::Error(ActiveStorage::FileNotFoundError):
2:TODO永远都要缓存这个
3: -->
4: 
5:     
6:     
7:     
8:
app/views/common/\u page\u head\u icons.html.erb:5
app/views/common/_page_head.html.erb:61
app/views/layouts/admin.html.erb:3

您可以为fs的IO访问配置应用程序吗?或者至少在另一台机器上尝试,以防与操作系统或fs相关?

您可以通过代码片段提供更多信息吗?例如,在开发环境中配置ActiveStorage和配置Puma。错误日志输出的副本。像这样的信息让帮助变得容易多了。谢谢,很好的观点,我已经更新了帖子。有效的观点和很好的建议,但我真的没有时间做这样的事情。这东西不是应该在没有任何麻烦的情况下工作吗?