gpt4 book ai didi

ruby 1.9 3 with passenger 3.0.12 - Tempfile 在尝试 rmdir 时导致 'No such file or directory' *.lock

转载 作者:太空宇宙 更新时间:2023-11-03 16:32:38 25 4
gpt4 key购买 nike

我认为 ruby​​ 1.9.3 无法在/tmp 目录中创建临时文件。问题错误信息:

Status: 500 Internal Server Error No such file or directory   /tmp/RackRewindableInput20121031-8340-1qko694.lock  
/lib/ruby/1.9.1/tempfile.rb:346:in rmdir'
/lib/ruby/1.9.1/tempfile.rb:346:in rmdir'
/lib/ruby/1.9.1/tempfile.rb:338:in ensure in locking'
/lib/ruby/1.9.1/tempfile.rb:338:in locking'
/lib/ruby/1.9.1/tempfile.rb:144:in block in initialize'
/lib/ruby/1.9.1/tmpdir.rb:133:in create'
/lib/ruby/1.9.1/tempfile.rb:134:in initialize'
/lib/ruby/gems/1.9.1/gems/passenger-3.0.12/lib/phusion_passenger/utils/rewindabl‌​e_input.rb:86:in new'

最佳答案

报同样的错误,当我尝试使用prince xml生成pdf文件时发生:

在本地机器上运行良好,开发和生产运行 webrick,但 passenger 导致崩溃。

这是我的回溯(简短版):

  Compiled print/print_core.css  (1ms)  (pid 14275)
Completed 500 Internal Server Error in 236ms

Errno::ENOENT (No such file or directory - /*** PATH DELETED ***/tmp/cache/assets/10948d89a043b6251405277a36d3e0e2.cache20130517-14275-1l2wvu7.lock):
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tempfile.rb:346:in `rmdir'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tempfile.rb:346:in `rmdir'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tempfile.rb:338:in `ensure in locking'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tempfile.rb:338:in `locking'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tempfile.rb:144:in `block in initialize'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tmpdir.rb:133:in `create'
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/tempfile.rb:134:in `initialize'
activesupport (3.2.9) lib/active_support/core_ext/file/atomic.rb:19:in `new'
activesupport (3.2.9) lib/active_support/core_ext/file/atomic.rb:19:in `atomic_write'
activesupport (3.2.9) lib/active_support/cache/file_store.rb:91:in `write_entry'
activesupport (3.2.9) lib/active_support/cache/strategy/local_cache.rb:140:in `write_entry'
activesupport (3.2.9) lib/active_support/cache.rb:364:in `block in write'
activesupport (3.2.9) lib/active_support/cache.rb:520:in `instrument'
activesupport (3.2.9) lib/active_support/cache.rb:362:in `write'
sprockets (2.2.2) lib/sprockets/caching.rb:90:in `cache_set'
sprockets (2.2.2) lib/sprockets/caching.rb:53:in `cache_set_hash'
sprockets (2.2.2) lib/sprockets/caching.rb:24:in `cache_asset'
sprockets (2.2.2) lib/sprockets/index.rb:92:in `build_asset'
sprockets (2.2.2) lib/sprockets/base.rb:169:in `find_asset'
sprockets (2.2.2) lib/sprockets/index.rb:60:in `find_asset'
sprockets (2.2.2) lib/sprockets/bundled_asset.rb:16:in `initialize'
sprockets (2.2.2) lib/sprockets/base.rb:252:in `new'
sprockets (2.2.2) lib/sprockets/base.rb:252:in `build_asset'
sprockets (2.2.2) lib/sprockets/index.rb:93:in `block in build_asset'
sprockets (2.2.2) lib/sprockets/caching.rb:19:in `cache_asset'
sprockets (2.2.2) lib/sprockets/index.rb:92:in `build_asset'
sprockets (2.2.2) lib/sprockets/base.rb:169:in `find_asset'
sprockets (2.2.2) lib/sprockets/index.rb:60:in `find_asset'
/var/www/*** PATH DELETED ***_core/lib/princely/pdf_helper.rb:83:in `asset_file_path'
/var/www/*** PATH DELETED ***_core/lib/princely/pdf_helper.rb:29:in `block in make_pdf'
/var/www/*** PATH DELETED ***_core/lib/princely/pdf_helper.rb:29:in `collect'
/var/www/*** PATH DELETED ***_core/lib/princely/pdf_helper.rb:29:in `make_pdf'
/var/www/*** PATH DELETED ***_core/lib/custom_pdf_helper.rb:28:in `make_pdf_with_defaults'
/var/www/*** PATH DELETED ***_core/lib/custom_pdf_helper.rb:59:in `make_tmp_pdf'
/var/www/*** PATH DELETED ***_concept/app/controllers/pdf_builder_controller.rb:171:in `build_pdf'

问题是由当 passenger 以用户“nobody”运行时的权限问题引起的,当配置文件归 root 时会发生这种情况。

在您的 apache/passenger conf 中设置以下内容使其工作

PassengerDefaultUser www-data # should be same as apache user

将 apache/rails 应用程序使用的所有文件/文件夹设置为

chown www-data:www-data

(在我的例子中是 chown -R tmp/)让它工作。

注意: 我认为,实际上错误是在 ruby​​ 尝试实际写入临时文件时发生的,但显然在这一刻没有出现错误。在下一步中,ruby 尝试删除一个不存在的临时文件并崩溃。

希望对您有所帮助!

关于ruby 1.9 3 with passenger 3.0.12 - Tempfile 在尝试 rmdir 时导致 'No such file or directory' *.lock,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13161133/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com