On 01/03/2012 01:09 PM, Kaya Saman wrote:
On 01/03/2012 08:06 AM, Sergiu Dumitriu wrote:
On 01/03/2012 12:35 AM, Kaya Saman wrote:
On 01/03/2012 07:30 AM, Sergiu Dumitriu wrote:
On 01/03/2012 12:13 AM, Kaya Saman wrote:
> Hi,
>
> first up Happy New Year to everyone :-)
>
> Secondly, I've been trying to stabilize my Xwiki install on FreeBSD
> 8.2
> x64. My machine is a quad core box with 4GB RAM and not much usage in
> terms of people viewing the wiki etc....
>
> I am getting this error:
>
> umbers=0&rev=11.1" java.lang.OutOfMemoryError: Java heap space
> Exception in thread "http-8180-Acceptor-0" java.lang.OutOfMemoryError:
> Java heap space
>
>
> I have attempted a resolution by including: - after Google'ing heavily
> to see what could be done to rectify the issue.
>
> JAVA_OPTS=-Xmx1024m
> JAVA_OPTS=-Xms1024m
> #JAVA_OPTS=-XX:PermSize=64M
> #JAVA_OPTS=-XX:MaxPermSize=256m
>
> at the top of the catalina.sh file but as I've just found out it
> didn't
> work.
>
>
> The strange thing is that I had this wiki migrated to an old
> PowerMac G4
> 733MHz with 384MB RAM and even though the cpu went up to max due to
> the
> amount of swap space consumed the system still worked fine for longer
> then my BSD machine at least.
>
> Can anyone give me a hand in order to diagnose the problem?
>
>
> I have tried this also on Nexenta Core 3 (OpenSolaris) on a virtual
> machine running on my notebook with 2GB RAM dedicated to it which
> worked
> fine also and was up for many weeks even though pathetically slow.....
> actually I was running Glassfishv3 but it was still Java!
>
>
> Thanks,
Indeed, the proper fix is to increase the amount of memory that the
JVM can use, and it should be done with the -Xmx1024m parameter as you
tried. And that value should be enough. Seeing that it doesn't work,
then catalina.sh must somehow discard that JAVA_OPTS variable along
the way. To test it, just do a ps or top after Tomcat is started to
see exactly what command line is being executed; does it have your Xmx
setting or not?
Anyway, I don't know how FreeBSD packages Tomcat, but normally you
shouldn't edit catalina.sh directly, there should be a dedicated
configuration file where you can specify parameters. On my Gentoo it's
in /etc/conf.d/tomcat-6. And the recommended variable to set is
CATALINA_OPTS, not JAVA_OPTS, and catalina.sh should append whatever
you set in CATALINA_OPTS to the final JAVA_OPTS that it computes and
which gets passed to the java command.
Thanks for that!
I've just changed the option to CATALINA_OPTS from JAVA_OPTS and see if
that works....
running ps aux gave me this output but nothing substantial:
The lines get trimmed if you get the output directly from the console,
you should either pipe it to less, or redirect to a file that you can
inspect later.
That actually was output that was dumped into a file!
Weird... I haven't used a BSD in years, so I don't remember much about
how it behaves.
USER PID
%CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
www 49976 26.5 2.6 313592 106244 ?? SsJ 5:31AM 0:07.31
/usr/local/diablo-jdk1.6.0/bin/java -
root 55971 0.0 0.0 5864 528 ?? SsJ Fri04PM 0:00.45 /usr/sbin/syslogd -s
pgsql 56160 0.0 0.0 46296 624 ?? IsJ Fri04PM 0:00.24
/usr/local/bin/postgres -D /usr/local
pgsql 56162 0.0 0.0 46296 1708 ?? SsJ Fri04PM 0:17.84 postgres: writer
process (postgres
pgsql 56163 0.0 0.0 18256 252 ?? SsJ Fri04PM 0:01.60 postgres: stats
collector process
root 56196 0.0 0.0 10952 1044 ?? SsJ Fri04PM 0:03.36 sendmail: accepting
connections (send
smmsp 56200 0.0 0.0 10952 764 ?? IsJ Fri04PM 0:00.07 sendmail: Queue
runner@00:30:00 for /
root 56206 0.0 0.0 6920 860 ?? SsJ Fri04PM 0:00.58 /usr/sbin/cron -s
root 48393 0.0 0.1 9252 2124 1 SJ 5:01AM 0:00.02 tcsh
root 50053 0.0 0.0 6976 984 1 R+J 5:32AM 0:00.00 ps aux
I have been told that FreeBSD has always had issues with Java so I'm not
quite sure if that's what is happening here but for some reason Tomcat
keeps quitting.
If whatever I try doesn't work I guess I may have to create a cron job
that will restart Tomcat everyday as then I'm less likely to encounter
this error? - nasty but am out of options.
I managed to sort it however!
For anyone else using FreeBSD and Java (Diablo JRE 6 and Tomcat6) and
hosting the Xwiki app:
Add:
tomcat60_java_opts="-Djava.awt.headless=true -Dfile.encoding=UTF-8
-server -Xms3072m -Xmx3072m -XX:NewSize=256m -XX:MaxNewSize=256m
-XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
To the /etc/rc.conf file.....
Great! This should be added to the installation documentation on
xwiki.org, let's see who has the time.
Majority of options in FreeBSD for services like mine
which has been
built using FreeBSD ports are in there!
Basically the -Xms and -Xmx values needed to be set to 3GB......
Now all is fine even though swap is heavily used but I guess that's Java!
-Xms and -XX:PermSize set the initial sizes of the heap and PermGen
spaces, which means that the JVM will request all that memory at once.
If you have other services/applications running besides Tomcat, it will
go into swap from the start. You should inspect the memory overall
consumption on the machine and try to decrease the Tomcat heap size a
bit, so that it all fits into RAM. 2.5G should probably do it.
I will still have to test over a long period of time
but it is looking
good currently.
For some flavors of Linux we have the contributed Glimpse system which
should take care of monitoring and automatically restarting Tomcat when
it stops responding, maybe you could see if you can make it work on FreeBSD.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/