2
vagrant@lucid32:/vagrant$ bundle exec unicorn_rails -c config/unicorn.rb -D -d
{:unicorn_options=>{:listeners=>[], :config_file=>"config/unicorn.rb"},
 :app=>
  #<Proc:0xa1a6ef4@/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn_rails:135 (lambda)>,
 :daemonize=>true}
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/cache
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/pids
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/sessions
Exception `Errno::EEXIST' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/fileutils.rb:247 - File exists - tmp/sockets
Exception `EOFError' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/launcher.rb:46 - end of file reached
master failed to start, check stderr log for details

残念ながら、stderr ログをチェックする方法がわからず、関連情報が見つかりません。

設定ファイルは次のとおりです。

working_directory "/vagrant"
pid "/vagrant/tmp/pids/unicorn.pid"
stderr_path "/vagrant/log/unicorn.log"
stdout_path "/vagrant/log/unicorn.log"

listen "/tmp/unicorn.todo.sock"
worker_processes 2
timeout 30

そして、これがnginx.confファイルです

upstream unicorn {
  server unix:/tmp/unicorn.todo.sock fail_timeout=0;
}


server {
  listen 80 default;
  # server_name example.com;
  root /vagrant/public;
  try_files $uri/index.html $uri @unicorn;
  location @unicorn {
      proxy_pass  http://unicorn;
  }

  error_page 500 502 503 504 /500.html;
}

問題は、/tmp ディレクトリが作成されていないことです。だから私はそれを作成し、同じエラーが発生し、それを削除して同じエラーが発生しました。そして今、私は無限ループに陥っています。

この作業を行うための方法、または少なくともエラーログの読み方についての助けをいただければ幸いです。

編集: stderr ファイルを見つけることができました:

/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.2278780536507904.2128, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.8313958669768073.2187, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.9130633695817217.2190, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
Exception `Errno::ENOENT' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:683 - No such file or directory - /vagrant/tmp/pids/unicorn.pid
Exception `Errno::ETXTBSY' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207 - Text file busy - (/vagrant/tmp/pids/0.59100125503182.2237, /vagrant/tmp/pids/unicorn.pid)
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.59100125503182.2237, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
/home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `rename': Text file busy - (/vagrant/tmp/pids/0.4331021743697998.2271, /vagrant/tmp/pids/unicorn.pid) (Errno::ETXTBSY)
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:207:in `pid='
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:137:in `start'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/bin/unicorn:126:in `<top (required)>'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `load'
        from /home/vagrant/.rbenv/versions/1.9.3-p392/bin/unicorn:23:in `<main>'
Exception `Errno::ENOENT' at /home/vagrant/.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/http_server.rb:683 - No such file or directory - /vagrant/tmp/pids/unicorn.pid
4

2 に答える 2

1

Unicorn プロセスはバックグラウンドで実行されています (-d)。ターミナルで以下のコマンドを入力します

ps aux | grep unicorn

実行中のユニコーンプロセスを強制終了してから、ユニコーンを再度起動します。

于 2013-07-08T19:35:21.120 に答える
0

これと同じ問題 (Text file busyエラー) があり、Vagrant VM からも実行されていました。@destiel のコメントは、問題を解決するのに役立ちました。どうやら、これはVagrant 共有フォルダーの実行railsによって引き起こされているようです。unicorn仮想ドライブにコピーした後、正常に機能しました。問題が発生した場合に備えて、Windows 8 ホストで実行しています。

于 2014-12-18T18:35:12.270 に答える