Heroku app throws "Internal Server Error" - ruby

This app works just fine on my local computer. After pushing it to Heroku, static pages appear to be working but the blog section throws an Internal Server Error. I pulled the logs by running "heroku logs" and this is what I get:
==> production.log <==
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/runner.rb:177:in `send'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'
/home/slugs/215194_e5b887e_c999/mnt/.bundle/gems/gems/thin-1.2.7/bin/thin:6
Something wrong with the eventmachine gem, I suppose....but it works fine on my machine. So I'm not sure what's going on or how to debug it.

From your error log, it looks like you are somehow trying to access a database with SQLite3. Heroku's uses Postgresql though, so clearly your database will fail to open. Heroku generates automatically the database.yml file, so the error is can't be there but maybe you are requiring and using sqlite3 directly?

I'm not sure how heroku handles things, but the trace/logs seem to say you might not have migrated your database. Is this the case?

Try updating the heroku gem. Worked for me.

Related

How to rectify oci8.c error when executing a rest ruby script on DB application?

I'm executing ruby scripts for a REST based application which uses oic8 gems from ruby. While executing I end up with following error
I'm executing in linux box
OCIError:
ORA-12705: Cannot access NLS data files or invalid environment specified
# oci8.c:694:in oci8lib_210.so
# /usr/local/rvm/gems/ruby-2.1.10/gems/ruby-oci8-2.2.2/lib/oci8/oci8.rb:147:in `initialize'
# ./lib/common/oracle_connection.rb:9:in `new'
# ./lib/common/oracle_connection.rb:9:in `initialize'
oci8.c:694:in oci8lib_210.so
/usr/local/rvm/gems/ruby-2.1.10/gems/ruby-oci8-2.2.2/lib/oci8/oci8.rb:147:in `initialize'
./lib/common/oracle_connection.rb:9:in `new'
./lib/common/oracle_connection.rb:9:in `initialize'
692# Couldn't get snippet for oci8.c
Please let me know what is that I'm missing here. I have installed oracle and set oracle home path and also installed ruby oci Gem.
Check that you (the person running ruby) have correct file permissions on the Oracle directory (or directories) so you can see files. Use chmod 755 as needed.

Gitorious: git-poller won't start

I just installed a fresh gitorious on my server and wanted to test it when I found out that the git-poller didn't run. And it also didn't want to start.
I followed this guide: http://gitorious.org/gitorious/pages/DebianSqueezeInstallation, my system is Debian Squeeze and Ruby -v says ruby 1.8.7
Everything from that guide works so far. The system is up and running but I can't start the poller. All the poller writes into the logs is the following:
tmp/pids/poller.log
*** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally ***
#<MissingSourceFile: no such file to load -- user_auto_completions_helper>
*** below you find all exception objects found in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***
#<NoMemoryError: failed to allocate memory>
#<SystemStackError: stack level too deep>
#<fatal: exception reentered>
#<LoadError: no such file to load -- daemons>
#<TypeError: Expected a filter, an endpoint, a callable or a list of any of these.>
#<NameError: uninitialized constant ActiveMessaging>
#<MissingSourceFile: no such file to load -- user_auto_completions_helper>
tmp/pids/poller.output
/home/clients/client1/web85/web/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant ActiveMessaging (NameError)
from /home/clients/client1/web85/web/vendor/rails/activesupport/lib/active_support/dependencies.rb:80:in `const_missing'
from /home/clients/client1/web85/web/vendor/rails/activesupport/lib/active_support/dependencies.rb:92:in `const_missing'
from /home/clients/client1/web85/web/lib/gitorious/messaging/stomp_poller.rb:13
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons/application.rb:203:in `load'
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons/application.rb:203:in `start_load'
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons/application.rb:292:in `start'
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons/controller.rb:70:in `run'
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons.rb:143:in `run'
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `call'
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `catch_exceptions'
from /var/lib/gems/1.8/gems/daemons-1.1.0/lib/daemons.rb:142:in `run'
from script/poller:30
I'm using ispconfig as a webserver management tool, that's where the weird paths are from. I changed all paths from the howto to fit, tho.
Anybody got an idea? I can provide more material if needed, but I just don't know what could be usefull. This is my first question on stackoverflow so please don't shoot me if I didn't do everything right :)
After a lot of reading and trial and error (I started about 3 times from scratch, trying Ruby 1.9.2 and REE both from source and with RVM) I tried another howto[1] which had one big difference to the first one: It suggested downloading and installing Rubygems 1.4.2 instead of the apt-version of Rubygems.
At first I didn't want to do that because I was afraid that it would break my system (there are a lot of other things running on that server, including Redmine) which it did, but after I re-installed all missing gems everything worked again.
Now everything (Gitorious and Redmine) is working with apt-version of Ruby 1.8.7 and the non-apt-version of Rubygems 1.4.2.
[1] http://cjohansen.no/en/ruby/setting_up_gitorious_on_your_own_server/
Since I stumbled upon another, hopefully last problem:
I installed gitorious for my standard web user (in order to respect ISPConfig's policy) and made a new git-user for the repositories. To be able to exchange data I added both to the same usergroup and fixed the permissions.
The problem I ran into was that the git poller added new repositories for his own, that means "git:git" instead of "git:sharedgroup". To fix this you just have to set the default group id for the git-folder (/var/git in my case):
chgrp -R <group_name> /var/git
chmod -R g+s /var/git
It appears that the two commands above did work but adding a new project broke everything again because the git-poller added a folder for the project and the repository which resulted in the repository-folder having the wrong owner again.
I (hopefully) fixed that with changing my /etc/init.d/git-poller script from
/bin/su - git -c "cd /var/www/git.mydomain.com/web;RAILS_ENV=production script/poller $#"
to
/bin/su - git -c "newgrp <group_name> && cd /var/www/git.mydomain.com/web;RAILS_ENV=production script/poller $#"

Deploy Sinatra template on Helicon Zoo

I installed the Ruby Hosting Package and Sinatra on Windows Server 2008R2 with IIS using Helicon Zoo.
I downloaded and imported the Sinatra template from Helicon Zoo Templates using web deploy on IIS
Now I get this error when navigating to the website:
[tid-7800168] paths need to start with / (ArgumentError)
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:30:in `block in remap'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:22:in `each'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:22:in `map'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:22:in `remap'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/urlmap.rb:18:in `initialize'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:142:in `new'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:142:in `generate_map'
C:/Ruby19/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:128:in `to_app'
C:/Zoo/Workers/ruby/lib/app.rb:45:in `build_app'
C:/Zoo/Workers/ruby/lib/app.rb:16:in `initialize'
C:/Zoo/Workers/ruby/lib/worker.rb:4:in `new'
C:/Zoo/Workers/ruby/lib/worker.rb:4:in `initialize'
C:/Zoo/Workers/ruby/zoorack.rb:30:in `new'
C:/Zoo/Workers/ruby/zoorack.rb:30:in `<module:Zack>'
C:/Zoo/Workers/ruby/zoorack.rb:12:in `<main>'
Any Ideas?
Please upgrade Helicon Zoo Module from the feed to the version 1.0.0.47. Just go to Zoo -> Modules and install it again.
Neil,
I posted a similar question just a couple of days ago, here.
As you can see from Yaroslav's reply, an updated version of Helicon Zoo module may help your case.
I think it is something to do with IIS Express installation in my case (I couldn't install it successfully through the web platform installer and had to go directly to download it from the MS site + when I run the ruby web server it works). I don't think my issue will help you, but maybe the Helicon update might?

Library `fcntl' can not be loaded on Solaris/Weblogic (JRuby 1.6.1) -> NullPointerException

While trying to deploy a JRuby/Rails Application to a Weblogic 10.3 (Solaris Zone) container it always encounters this exception:
org.jruby.rack.RackInitializationException: library `fcntl' could not be loaded: java.lang.NullPointerException
from /xyz/war/WEB-INF/gems/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `require'
from /xyz/war/WEB-INF/gems/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
from /xyz/war/WEB-INF/gems/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /xyz/war/WEB-INF/gems/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:225:in `load_dependency'
from /xyz/war/WEB-INF/gems/gems/activesupport-3.0.6/lib/active_support/dependencies.rb:239:in `require'
from /xyz/war/WEB-INF/gems/gems/jruby-openssl-0.7.3/lib/openssl/ssl.rb:19:in `(root)'
from org/jruby/RubyKernel.java:1038:in `require'
[..snip...]
It just don't get it why JRuby fails to load this core library. It seems somehow Solaris related, because installing WLS on MacOS X and deploying locally works without any issues.
Any hints, or pointers where I can look next - or how to solve this issue?
UPDATE:
Probably a bug (got feedback in IRC/#jruby now tracked in JRuby JIRA, see: http://jira.codehaus.org/browse/JRUBY-5753
I solved this issue by adding -d32 to JAVA_OPTS, to force the use of a 32-bit JVM.
I was experiencing this problem on Centos 5 and OSX with Tomcat 7 and Jruby 1.7.2. and a sqlite3 db.
I resolved the issue through poking around and I'm not sure why what I did solved it but I discovered a few things:
I got this error after restarting Tomcat due to a previous crash which left the DB locked.
ActiveRecord::StatementInvalid (Java::JavaLang::Error: Internal Error in _syscall(): SELECT "urls".* FROM "urls" ):
The following steps seemed to resolve the issue, though it seems to me that the original error simply indicates that the DB got into a bad state.
-I downgraded Jruby to 1.7.1
-I removed all gems pertaining to the db from the gemfile except activerecord-jdbcsqlite3-adapter'. This seemed to resolve this issue. (The gems I removed were 'sqlite-ruby','sqlite3','activerecord-jdbc-adapter', 'jruby-rack') I note that the first gem here was a normal C gem, which shouldn't have been deployed because it wasn in a conditional but seemed to be getting included in the war by warbler anyway.
Anyway, I redeployed and it worked, even using the original DB.

Why am I getting an OpenSSL::SSL::SSLError only on Windows?

I'm downloading files from a HTTPS website. I've narrowed the problem down to this:
>> require 'open-uri'
>> open('https://www.gmail.com/') # just as an example
C:/Ruby/lib/ruby/1.8/net/http.rb:586:in `connect': certificate verify failed (OpenSSL::SSL::SSLError)
from C:/Ruby/lib/ruby/1.8/net/http.rb:586:in `connect'
from C:/Ruby/lib/ruby/1.8/net/http.rb:553:in `do_start'
from C:/Ruby/lib/ruby/1.8/net/http.rb:542:in `start'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:242:in `open_http'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:616:in `buffer_open'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:162:in `catch'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:518:in `open'
from C:/Ruby/lib/ruby/1.8/open-uri.rb:30:in `open'
from openuri_sandbox.rb:3
This code works just fine on Mac OS X or Linux, but it just started failing on Windows. I've tested on a few Win XP installations and one Win 7 installation -- they all fail. They're all running Ruby 1.8.6 patchlevel 287. What's going on here? We know we can turn off SSL verification and it works (or at least seems to), but that seems like a poor solution.
I'm interfacing with the website in question using Mechanize, so I'd like to be able to continue to use that.
Update: It looks like the problem with Mechanize might be specific to Windows 7, unlike I previously thought. It worked just a couple of weeks ago, though.
Update 2: This is still happening on Windows (XP and 7), but not on Linux. It's no longer a problem in the important script I needed to make work, though -- still not sure why.
appears it happens because ruby doesn't ship with certificates? http://betterlogic.com/roger/2011/08/github-jruby-ssl-woe/
Could the difference be 32-bit vs 64-bit architecture?
I'm seeking the same solution myself. I resolved this issue on the command line using cURL and the information to set-up a CA-bundle. I'm still looking for a Ruby fix.
This is a common issue across on Linux, Windows, Windows, Mac, Ruby 1.8, Ruby 1.9 and JRuby from my testing/experiments.

Resources