On 01/03/2012 08:35 PM, Sergiu Dumitriu wrote:
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:

first up Happy New Year to everyone :-)

Secondly, I've been trying to stabilize my Xwiki install on FreeBSD
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.


at the top of the catalina.sh file but as I've just found out it

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
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
fine also and was up for many weeks even though pathetically slow.....
actually I was running Glassfishv3 but it was still Java!


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.

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:


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.

That's me! I'll do it :-) - unemployed at mo so have bundles or oodles of time to spare. Let me just get my own wiki and main site working properly up to the way I want them to then should be ok.

Actually come to think of it I maybe able to get away with 1.5GB for heap as I was trying to remove a very large album from the photo plugin app.

Currently top output is as:

76547  19 www         43  76    0  3525M   428M ucond   0   0:27  0.00% java
75843  14 www         43  76    0  3512M   408M ucond   0   0:33  0.00% java

so if RES means resulting size in memory then things should be ok to decrease the -Xms and Xmx.

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'll look at tailoring soon currently memory usage shows this:

Mem: 837M Active, 115M Inact, 1672M Wired, 7548K Cache, 408M Buf, 1197M Free
Swap: 2327M Total, 110M Used, 2216M Free, 4% Inuse

Even though the system is a main server running multiple FreeBSD Jails but still BSD has such a low footprint in comparison to any other OS I've seen it's pretty amazing.

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.

Definitely! As stated I've got the time now so will have a little look. :-)

btw, I really enjoy xwiki! I've tried or looked at a few other wiki softwares which aren't nearly as customizable or multipurpose as xwiki is. I guess the only way I can contribute is by using the software and keeping on writing howto's about it which I've kinda started on my own project:


but yeah I mean I wish I could deploy it at many different installations for 3rd parties as it's cool!



users mailing list

Reply via email to