JRoR memory leak on tomcat
--------------------------

                 Key: JRUBY-3281
                 URL: http://jira.codehaus.org/browse/JRUBY-3281
             Project: JRuby
          Issue Type: Bug
          Components: Rails WAR Deployment
    Affects Versions: JRuby 1.1.6
         Environment: Mac OS X 10.5.6
            Reporter: Miika Leppänen


- Downloaded apache tomcat 6.0.18
- unzipped to ~/apps/tomcat
- modified bin/setenv.sh
mlemacbook:bin milep$ cat setenv.sh 
export 
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
export JAVA_OPTS="-server 
-Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true"
export CATALINA_OPTS="
-Xms256m 
-Xmx512m 
-XX:PermSize=128m 
-XX:MaxPermSize=256m
-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.port=7070
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password 
-Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access"

mlemacbook:bin milep$ chmod a+x *.sh



mlemacbook:rails milep$ java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)

mlemacbook:rails milep$ jruby -v
jruby 1.1.6 (ruby 1.8.6 patchlevel 114) (2008-12-18 rev 6586) [x86_64-java]

mlemacbook:rails milep$ jruby -S rails -v
Rails 2.2.2

mlemacbook:rails milep$ jruby -S gem update --system
Updating RubyGems
Nothing to update

mlemacbook:rails milep$ jruby -S gem list --local
*** LOCAL GEMS ***

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activerecord-jdbc-adapter (0.9)
activerecord-jdbcmysql-adapter (0.9)
activeresource (2.2.2)
activesupport (2.2.2)
builder (2.1.2)
capistrano (2.5.2)
capistrano-ext (1.2.1)
ci_reporter (1.5.2)
echoe (3.0.2)
glassfish (0.9.1)
highline (1.5.0)
hoe (1.8.2)
jdbc-mysql (5.0.4)
jruby-openssl (0.3)
net-scp (1.0.1)
net-sftp (2.0.1)
net-ssh (2.0.4)
net-ssh-gateway (1.0.0)
rack (0.4.0)
rails (2.2.2)
rake (0.8.3)
rspec (1.1.11)
rspec-rails (1.1.11)
rubyforge (1.0.1)
rubyist-aasm (2.0.2)
sources (0.0.1)
warbler (0.9.12)

mlemacbook:rails milep$ jruby -S rails memtest

mlemacbook:rails milep$ cd memtest

mlemacbook:memtest milep$ jruby -S warble config
cp 
/usr/local/jruby-trunk/lib/ruby/gems/1.8/gems/warbler-0.9.12/generators/warble/templates/warble.rb
 config/warble.rb

mlemacbook:memtest milep$ jruby -S warble pluginize
Unpacked gem: 
'/Users/milep/projects/rails/memtest/vendor/plugins/warbler-0.9.12'

mlemacbook:memtest milep$ ls vendor/plugins/warbler-0.9.12/lib/
jruby-complete-1.1.6.jar        warbler
jruby-rack-0.9.3.jar            warbler.rb

mlemacbook:memtest milep$ nano config/database.yml 

mlemacbook:memtest milep$ cat config/database.yml 
development:
  adapter: jdbcmysql
  encoding: utf8
  database: memtest_development
  username: root
  password:
  host: 127.0.0.1

mlemacbook:memtest milep$ jruby -S rake db:create
(in /Users/milep/projects/rails/memtest)

uncommented following lines from config/warble.rb
config.gems += ["activerecord-jdbcmysql-adapter", "jruby-openssl"]
config.gems["rails"] = "2.2.2"

mlemacbook:memtest milep$ jruby -S warble war RAILS_ENV=development
...

mlemacbook:memtest milep$ cp memtest.war ~/apps/tomcat/webapps/

open http://localhost:8080/memtest/

About your application's environment
Ruby version    1.8.6 (java)
RubyGems version        1.3.1
Rails version   2.2.2
Active Record version   2.2.2
Action Pack version     2.2.2
Active Resource version 2.2.2
Action Mailer version   2.2.2
Active Support version  2.2.2
Application root        /Users/milep/apps/tomcat/webapps/memtest/WEB-INF
Environment     development
Database adapter        jdbcmysql
Database schema version 0

mlemacbook:memtest milep$ cat touch.rb 
require 'net/http'

50.times { |i|
  `touch /Users/milep/apps/tomcat/webapps/memtest.war`
  p "touched #{i}"   
  sleep(120) 
  t1 = Time.now
  res = Net::HTTP.get_response(URI.parse('http://localhost:8080/memtest/'))
  p "res.code=#{res.code} time: #{Time.now - t1}"
  sleep(5)
}

mlemacbook:memtest milep$ ruby touch.rb 

And wait for the out of memory error, takes about 30 mins with these settings.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to