Not getting debug output for view errors in development mode - ruby-on-rails

This is very odd. At the moment, I have some kind of error in a view, but can't see what it is. Also, no debug output in the web server trace.
The Rails 3.2.2 app is an upgrade from 2.7.10, and I'm using "thin" as my development server. I do get normal debug output when the error occurs in other places.
EDIT: I'm running development, as you can see here:
=> Booting Thin
=> Rails 3.2.2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop
EDIT: I can duplicate this behavior by raising an exception in the controller.

Please check you development.rb and ensure that
config.consider_all_requests_local = true
Otherwise exceptions and stack traces will not be shown.

I would compare the files in your ./config directory of your app with those of a clean Rails 3.2 install. They've restructured things pretty significantly and there are often strange errors like this that popup if you don't properly upgrade all the config files.

Related

How to change WEBrick :AccessLog option when running RedMine?

I'm running RedMine via WEBrick using the following command line (simplified):
bundle exec rails server webrick -e production -p 3012 -P '/var/lib/redmine/redmine.pid'
I don't like how WEBrick outputs the peer address at the beginning of its access log lines (because I'm running it behind nginx and the peer address is always 127.0.0.1), so I want to change the access log format.
I know that I need to tune the :AccessLog config option for WEBrick, but I don't know how to get my hands on it. WEBrick is run by the rails server command, via the rack abstraction, and I don't see an obvious way to pass the necessary configuration to WEBrick.
So, is there any way to do it? Some command line switch? -c is the only switch that accepts some kind of configuration file, but it references "rackup", and I have no idea how to work with it.
Maybe it can be done by changing configuration files? I tried to modify additional_environment.rb by adding config[:AccessLog] = [ [ $stderr, WEBrick::AccessLog::COMMON_LOG_FORMAT ] ], but it had no effect (although the file was executed), so I assume this file's config is not what is passed to WEBrick.
I'm pretty sure there is some way to configure this option without creating a new Rails application and invoking WEBrick manually, and hopefully even without changing RedMine files.

Everything worked, but then IntelliJ IDEA 14.02 has turned off, and then restart the project is not run and displays the following information

Everything worked, but then IntelliJ IDEA 14.02 has turned off, and then restart the project is not run and displays the following information :
"C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.2\bin\runnerw.exe" C:\tools\rubies\ruby-2.1.5-p273\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) E:/work/my_store/bin/rails server -b 127.0.0.1 -p 3000 -e development
=> Booting WEBrick
=> Rails 4.1.8 application starting in development on http://127.0.0.1:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check E:/work/my_store/tmp/pids/server.pid.
Exiting
Process finished with exit code 1
in the document E:/work/my_store/tmp/pids/server.pid. only four digits
4108
I use Windows 8, how to solve this problem ?
Use the Task Manager to check if a server process is running. If it is, stop it from the task manager. If not, delete the server.pid file.
I decided all by himself. server.pid deleted file later to restart the project file server.pid again been created, I deleted it again, restarted the computer and it worked

Why does my WEBrick server get killed?

I've got a rails development environment running in DigitalOcean on Ubuntu 12.04, but my WEBrick process keeps getting "killed" after a couple of hours. I haven't been able to find any settings or configuration that would cause this.
Example Console Ouput:
user#machinename:~/git/app$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-01-05 09:14:29] INFO WEBrick 1.3.1
[2014-01-05 09:14:29] INFO ruby 2.0.0 (2013-11-22) [x86_64-linux]
[2014-01-05 09:14:29] INFO WEBrick::HTTPServer#start: pid=23452 port=3000
Started GET "/" for x.x.x.x at 2014-01-05 09:14:37 +0000
Processing by FunController#welcome as HTML
...
The server and app run just fine when I'm using it. But, at some point, my server will quit working. And, I'll look at the console to see this output from WEBrick:
Killed
And kick me back out to the shell. Any ideas what is causing this?
It runs out of memory. The linux kernel kills it. Droplets don't come with any 'swap' by default, so when the memory gets full, it kills a process or won't let you start a new one. Kinda crazy.
Here's an article walking you through adding a swapfile:
https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04
Note: I still had some problems with compiler processes being 'killed' even after adding a swapfile when 'swappiness' was set to 0. Upping it to 20 fixed the problem.
Note2: You really shouldn't use webrick in production as others have mentioned in the comments. Still, a question is a question :)

Aptana Studio: A server is already running error

Sometimes when I boot up my computer then open up Aptana Studio for Rails, then try to start my server, I get the following error...
=> Booting WEBrick
=> Rails 3.2.11 application starting in development on http://localhost:3000
=> Call with -d to detach
A server is already running. Check C:/Users/bob/bob_rails_demo/Course_Stats/tmp/pids/server.pid.
=> Ctrl-C to shutdown server
Exiting
When I check that file metioned, I open the file and all it says inside the file is ...
512
Is there a fix for this? I don't see anything else running in task manager. BTW I am running rails 3.2.11 w/ Windows 7.
I have the same problem too, and it didn't happen before, so i believe it is some kind of bug. What I do to solve it is simply delete the server.pid at C:[pathToApp]\tmp\server.pid file before starting my server.
It is saying that PID (process id) 512 is running the server.
Go to Start -> then type taskmgr.exe. Then, go to the processes tab and look for that process and kill it. It might be a bug that it does not close the server correctly on exit.

Rails Stack Level too deep

How can I get more information from an error like this?
=> Booting WEBrick
=> Rails 3.1.1 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
script/rails:6: stack level too deep (SystemStackError)
The error was only occurring in production.
When changing settings inside config/environments/production.rb, I found that setting config.cache_classes = false let me boot the app in production. Upon reviewing the commit I found the offending class.
I had created a model called Object which seemed to have interfered with the way caching works, likely overwriting a core ruby Object class.
It's a loop. To have more details of this, you et "config.log_level = :debug" in the config/environments/production.rb and restart your server

Resources