Upgrading from jruby-9.0.5.0 hangs tomcat - ruby-on-rails

I am trying to upgrade jruby. Went to a latest version 9.1.12.0, didn't work. Tried one version up (9.1.0.0) and same issue
The issue is it takes a very long time to boot on tomcat. Once tomcat starts the application it becomes unresponsive. Browser hangs forever and then eventually times out. Tomcat log shows that the request came, was served reply and closed (everything normal). No errors show up in tomcat log.
Tomcat is sitting behind apache, connected though AJP. I tried switching to http(s) and neither worked. Going directly to tomcat yields the same results.
I worked on solving this issue for quite some time. Not sure why it hangs and doens't throw any errors. Tried changing configurations on rails/tomcat/apache and could not find why it doens't work.
Any help tracking down this issue would be greatly appreciated
Current stack:
Rails 4.1..15
Jruby 9.0.5.0
Tomcat 6
Java 1.7.0_131
Apache 2.4.7

sounds like an enthropy depletion might be going on,
export JRUBY_OPTS=-J-Djava.security.egd=file:/dev/./urandom
or in your case :
export CATALINA_OPTS=-Djava.security.egd=file:/dev/./urandom
explanation is this' questions answer: After Upgrade To JRuby 9.1.9.0, Rails CookieStore Very Slow When Handling Encrypted Cookies
... the next jruby-openssl release should hopefully handle this better

Related

Can no longer deploy Grails 2.2.5 app on Tomcat

I have run into a very serious problem where I can longer deploy a war of a Grails 2.2.5 web application on Tomcat. The build (with 'grails war') proceeds without a problem, and I deploy it to Tomcat. I retsart Tomcat, and the web application simply does not run. It comes up with the deploying message, but clearly doesn't get as far as running Bootstrap.groovy, because logging from there doesn't show up in the log. No error messages are given, but the web app is simply not running.
I ran into a similar problem a few days ago on a different server which I solved by upgrading to Tomcat 7, but this one is already running Tomcat 7. I have no idea why this has started happening, unless it is something obscure to do with the recent change in Maven where only TLS 1.2 connections are allowed (a change which occurred a week or so ago).
So what could be happening? Is there some way I can log what is happening as the web app starts up, such that I might be able to see where the problem is occurring?
If it is of any relevance, it works OK when I do 'grails run-war' on my development machine.

wrong number of arguments (given 0, expected 1) after deployment JROR

Ror Experts,
I am having some kind of routing issue (I think so..). The Ahoy tracks visits and events in the development environment - running under webbrick server. When the application is deployed using warbler and published to apache tomcat server, it throws 500 error, Wrong number of Arguments (given 0, expected 1) while trying to log events. Tracking visits works as expected.
I have already tried suggestions mentioned in ahoy github account (https://github.com/ankane/ahoy/issues/356) without success.
I tried to debug if the data from react code is sending data as expected. It is indeed sending the data. I tried to post the data using postman directly to the controller using the same load to both development and deployed environment. It works on development but not on deployed.
I also tried to check error logs on the server. There is no information except 500 error.
Can someone help me out...
PS:
Prod server: Apache Tomcat
Environment: Jruby on rails
Front End: React
Found a solution. Fixed using gem as integral part of application instead of gem...... Still doesn't know what caused the issue. My gut feeling is some kind of routing issue with jruby and bundler warbler.

Passenger Hanging after Restart - Shared Hosting Environment

Last night I made a revision to [app-root]/config/initializers/refinery/core.rb and the touched [app-name]/tmp/restart.txt. Then I tried to reload the app to find it totally hanging. The other two RoR apps I'm running on the same server were also hanging. Per curl -v there was no response at all from the server.
Everything was working fine before I touched the restart.txt file. The following morning, seven or eight hours later, the sites are working again and my minor edit (the site name) is showing up.
Rails 3.2.16 on a hostmonster linux server.
The instance of Passenger is not running under my user so I wonder if my hang horned any other user's RoR sites?
I can't restart apache (of course) since this is a shared server. Any suggestions for how to deal with this if it happens again? I have no budget for Heroku or a VPS.
UPDATE: Did the same steps again this morning, revised the core.rb and asked for a restart by touching restart.txt and it restarted in less than a minute. The question remains valid I think - what can a person do to address a hanging Passenger or prevent it from happening?

Rails environment deployment issue?

I'm trying to deploy my first Rails app here, and I've been stuck on something since last night. I'm encountering some weird behaviors I can't explain.
I'm running Rails, Apache, Phusion Passenger, and for the moment, SQLite 3. (I'll move that over to MySQL shortly.) Currently this is being hosted on a too-small EC2 slice running Ubuntu Server 11.04 (Natty).
When I visit the address of the EC2 slice in the browser, I get the default Rails 500 notice. Here's what's weird, though. When I tail /log/production.log, I see the following error:
ActionView::Template::Error (SQLite3::SQLException: no such table: offers: SELECT "offers".* FROM "offers" WHERE (code = '') ORDER BY created_at desc LIMIT 25 OFFSET 0):
So, I manually opened up the development database in SQLite3, and saw that table in there. The production database, however, does not have that table.
OK, so I'm getting errors with the production database logged in the production log. The application has to be running in production mode, right?
That is what's throwing me. First of all, it's running in development mode on my development machine, and I didn't change any of the files when I deployed it. Neither did I use any fancy deployment tools to deploy it (which may have switched something without my knowledge) - I just did a simple git push.
Furthermore, I added the following to my httdp.conf VirtualHost config:
RailsEnv development
Also, when I run rails console, I can get the following:
irb(main):002:0> Rails.env
=> "development"
So, the application really should be running in development mode, right? In fact, it seems to think (partially) that it is, right?
I'm really not sure what's happening here, and I'd really appreciate some expert advice.
Thanks everyone.
Edit - A few server reboots later, and now the thing just hangs when I try to view it in a browser. Also, Apache seems to hang when I try to restart it (hence the server reboots), related problem, or different problem altogether?
Well, this isn't a 100% satisfactory answer for me, but I did two things, and I think I got it working.
First, I re-installed the passenger Apache module. That may or may not have been necessary.
This was the big thing, though: after I had added the line to httpd.conf to pass the Rails Environment over to Passenger, I believe Apache restarted incorrectly. (Rather, I believe I've been restarting Apache incorrectly for my whole life!)
I was trying to restart Apache this way:
sudo /etc/init.d/apache2 restart
That has always worked for me (when programming PHP), but it simply wasn't working here. Apache would just stall on the restart.
This, however, works fine:
sudo apachectl restart
I'll have to ask Server Fault what the significant difference is between the two.
I hope that helps someone out.

Apache+Passenger - Apache running; but not responding to requests

Background
I'm running a Ruby on Rails application that has to serve a lot of static files as well.
My setup currently is:
Debian Linux Lenny 5.0
Apache 2.2.9
Passenger 2.2.10
The problem
Everything runs fine. I see apache process spinning up, passenger instances get created and everything works fast and snappy.
Then, after some time Apache does not respond to requests any more. Clients do get a connection and are "waiting for a response", but none comes.
I cannot manually reproduce this problem. Sometimes it occurs a few hours after a restart, other times it takes a few days to happen. Here's what I found:
Apache process are up; Passenger is there, but it does not have any instances spun up (probably because instances die after a period of inactivity)
No error messages or problems in /var/log/syslog, /var/log/messages, not in apache's access and errors logs, not in my Rails production log. Nothing.
When I stop and start apache everything is back to normal.
Does any one have any clues what's happening here? And how it can be resolved?
Due to an enormous load on static files we decided to host static files on separate server (later Amazon S3+CloudFront) for performance reasons.
My current guess is that Apache couldn't cope with the large number of requests on static files and also doing Passenger. The current setup is Nginx+Unicorn for the Rails application and S3+CloudFront for static files.

Resources