Stash as a service

Hi all,

I successfully got Stash running as a console application and set it up to connect to a sql server db using integrated authentication. The next piece of the puzzle is to get it running as a windows service (I'm using 64bit Win2008R2). I followed the instructions, installed the 64 bit JDK, altered the tomcat exe & dll to use the 64 bit versions etc. but I can't get it to work.

The browser just seems to try to load and the tomcat.exe process on the server spins right up to 99% CPU usage.

An excerpt from the log file says this -

2013-03-15 14:59:41,991 ERROR [localhost-startStop-1] c.a.e.i.AsynchronousAbleEventDispatcher There was an exception thrown trying to dispatch event '' from the invoker 'SingleParameterMethodListenerInvoker{method=public void com.atlassian.stash.internal.event.EventListenerRegistrar.onPluginModuleDisabled(, listener=com.atlassian.stash.internal.event.EventListenerRegistrar@2bc7005b}'.

java.lang.RuntimeException: PermGen space

I did some research into the PermGen exception and tried increasing the STASH_MAX_PERM_SIZE to 512m without luck. This is a brand new installation so it shouldn't need anything out of the ordinary however.

A side note that may or may not be relevant is that the JDK paths did not match what was in service.bat.

ie: if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome

I needed to alter (all instances of) to

if not exist "%JAVA_HOME%\jre7\bin\java.exe" goto noJavaHome

Any help is appreciated.


1 answer

1 accepted

0 votes
Accepted answer

Hi Greg,

A few things. The JAVA_HOME you want should actually include 'jre7'. That is to say JAVA_HOME should always include a 'bin' directory with 'java'. What you're actually using is the JDK_HOME which is slightly different, the scripts themselves are fine.

More importantly , 512m should definitely be enough permgen to get Stash running. What is possibly the case is that your actual Windows service hasn't been updated. Apparently when you modify the service.bat you will need to re-install the service to see the changes. You can also manually do what our permgenservice.bat is doing and add the parameter:

//US//%SERVICE_NAME% ++JvmOptions "-XX:MaxPermSize=512m"

This is similar to what we talk about here regarding max memory:

I hope this helps.


Hi Charles,

Thanks. It was an issue with the environment variables. I had both JAVA_HOME & JDK_HOME defined. Once I removed JAVA_HOME it started working correctly.


Suggest an answer

Log in or Sign up to answer
Community showcase

Scrum Roles Explained: the Do's and the Don'ts

Hello Community,  Today we are going to talk about the three Scrum Roles. There is the Development Team, the Scrum Master and the Product Owner. In my opinion these three are all really impo...

64 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you