500 Internal Server Error after accidental reconfig

Added by Brennan Johnson over 9 years ago

Hello,

So this error's on me but hopefully someone could help me out.

Changed the url within the Admin console within my redmine installation from the default "localhost:3000" to "localhost" - my intention was to designate another port but that didn't happen before save was clicked.

So I killed the webrick daemon and restarted redmine, hoping it hadn't saved my error. Navigate to localhost and: 500 Internal Server Error.

Is there anyway to reset this setting or to change it back to the default of 3000? Either through the Postgresql database or editing one of Redmine's config files (config/settings.yml for example - even though you aren't supposed to, I know, I know - just thinking to get me online long enough to reset that setting via the webgui).

My setup:
- Ruby implementation and version: 1.8.5
- Rails version: 2.2.2
- Operating system: Debian 2.6.18-6-k7 (i686)
- Database used, and its version: Postgresql 8.1.15
- Ruby-aware server used: Webrick

Thanks,
Brennan

Replies (8)

RE: 500 Internal Server Error after accidental reconfig - Added by Brennan Johnson over 9 years ago

$ ruby script/server webrick -e production
=> Booting WEBrick...
=> Rails 2.1.2 application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2009-03-17 17:59:28] INFO WEBrick 1.3.1
[2009-03-17 17:59:28] INFO ruby 1.8.5 (2006-08-25) [i486-linux]
[2009-03-17 17:59:28] WARN TCPServer Error: Address already in use - bind(2)
/usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `new'
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `each'
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen'
from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
from /opt/redmine/vendor/rails/railties/lib/webrick_server.rb:58:in `new'
... 7 levels...
from /opt/redmine/vendor/rails/railties/lib/commands/server.rb:39
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'

$ netstat -nlt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:33475 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN

Curiouser and Curiouser.

RE: 500 Internal Server Error after accidental reconfig - Added by Jean-Baptiste Barth over 9 years ago

It seems you already have something on port 3000 ; maybe you can find PID/process with netstat -tanpl ? You may also use "-p" option on webrick to boot on an other port.
I don't think your 500 error is due to this Redmine setting..

RE: 500 Internal Server Error after accidental reconfig - Added by Brennan Johnson over 9 years ago

Webrick runs on port 3000

Though its config file points to port 80:
/usr/lib/ruby/1.8/webrick/config.rb
...
:Port => 80,
...

I'm not using mongrel or apache in this particular setup.

RE: 500 Internal Server Error after accidental reconfig - Added by Brennan Johnson over 9 years ago

Jean-Baptiste Barth wrote:

It seems you already have something on port 3000 ; maybe you can find PID/process with netstat -tanpl ? You may also use "-p" option on webrick to boot on an other port.
I don't think your 500 error is due to this Redmine setting..

Tried this with say: ruby script/server webrick e production -p 3131
=> Booting WEBrick...
=> Rails 2.1.2 application started on http://0.0.0.0:3131
=> Ctrl-C to shutdown server; call with --help for options
[2009-03-18 08:19:21] INFO WEBrick 1.3.1
[2009-03-18 08:19:21] INFO ruby 1.8.5 (2006-08-25) [i486-linux]
[2009-03-18 08:19:21] INFO WEBrick::HTTPServer#start: pid=5326 port=3131
192.168.201.183 - - [18/Mar/2009:08:19:28 PDT] "GET / HTTP/1.1" 500 60
> /
192.168.201.183 - - [18/Mar/2009:08:19:29 PDT] "GET /favicon.ico HTTP/1.1" 200 0
-> /favicon.ico

As you can see, when trying to access it, no go.

RE: 500 Internal Server Error after accidental reconfig - Added by Brennan Johnson over 9 years ago

Ok, so I fixed this issue by telling webrick to utilize port 80 (which I configured via the webgui - which broke everything) and started webrick as root (for testing sake).

So simply:

$ sudo ruby script/server webrick -e production -p 80
Password:
=> Booting WEBrick...
=> Rails 2.1.2 application started on http://0.0.0.0:80
=> Ctrl-C to shutdown server; call with --help for options
[2009-03-18 08:33:07] INFO WEBrick 1.3.1
[2009-03-18 08:33:07] INFO ruby 1.8.5 (2006-08-25) [i486-linux]
[2009-03-18 08:33:07] INFO WEBrick::HTTPServer#start: pid=5359 port=80

I hope this helps someone else down the road.
Thank you Jean-Baptiste for that -p option, I didn't know about that and inevitably that led to the fix.

Peace,
Brennan

RE: 500 Internal Server Error after accidental reconfig - Added by Jean-Baptiste Barth over 9 years ago

Great! Just a precision : as far as I know, the setting you can configure in Redmine settings does not configure itself the way the server (mongrel, webrick, etc.) is started ; it just tells Redmine "when you have to build a A link in the application, put this adress in front of it". So if you misconfigure it and restart the server, maybe Redmine tries to redirect you to a broken URL... I don't know if I'm clear, nor if it is totally exact, but maybe it can help to understand.

Happy to see it works for you, cheers !

RE: 500 Internal Server Error after accidental reconfig - Added by Paul Toytoy over 9 years ago

Hi guys, I also encountered this. I use "thin" web server.

When I access through the default port 3000, it says this

??Internal error

An error occurred on the page you were trying to access.
If you continue to experience problems please contact your redMine administrator for assistance.??

However, when I change the port to 81, it works. It's actually fine doing it with port 81, but the users are already used to access through port 3000 and also there are links we have attached or linked to our notes which clicking them might lead to a broken link.

Any idea of the problem why it works in 81, but not in 3000?

p.s. I already emptied my "log" directory.

RE: 500 Internal Server Error after accidental reconfig - Added by Brennan Johnson over 9 years ago

Can you access it on other ports, say if you start up the service with the -p option and specify another port (like 5555 or something wacky).

Any helpful information in the logs? I know you already emptied it (why?) but those regenerate :) and it's always helpful to tail them while you're debugging these sort of issues.

Could you post any relevant information you got from the logs or any other specific error messages?

(1-8/8)