CDV ❯ Terracotta server does not run under Apache procrun
-
Bug
-
Status: Open
-
2 Major
-
Resolution:
-
-
-
prodmgmt
-
Reporter: hmak
-
August 26, 2009
-
0
-
Watchers: 1
-
March 19, 2010
-
Description
Terracotta server does not run under Apache procrun (http://commons.apache.org/daemon/procrun.html). The problem is that com.tc.server.TCServerMain.main() returns too early, making procrun believe the process is dead. Request that main() block until the server is shut down.
To reproduce:
- Install TC server as a Windows service
procrun.exe //IS//VMPTCSERVER –DisplayName=”Terracotta server” –install=procrun.exe –Jvm=%JAVA_HOME%\jre\bin\server\jvm.dll –JvmMs=512 –JvmMx=512 –Classpath=%TC_HOME%\lib\tc.jar –JvmOptions=-XX:+HeapDumpOnOutOfMemoryError;-Dtc.install-root=%TC_HOME% –Startup=auto –StartMode=jvm –StartClass=com.tc.server.TCServerMain –StopMode=java –StopParams=-cp;%TC_HOME%\lib\tc.jar’;com.tc.admin.TCStop; –LogPrefix=win_service.log –LogLevel=DEBUG
-
Start TC server from Windows Service Control Manager (services.msc)
-
win_service.log will show JVM created but process will terminate
Expected behavior:
Process should not terminate and should appear as “Started” in services.msc
Comments
Howard Mak 2009-08-26
Fiona OShea 2009-08-26
Field to try Richard Wilkinson fix for running as a service
Sreenivasan Iyer 2009-08-27
Yes the mechanism suggested at http://richard-wilkinson.co.uk/2008/07/11/how-to-run-terracotta-as-a-service/ does work. In any case, for right now there is a workaround in play to make it work with Apache Procrun as well. It should be fixed at some point though, correctly.
Email correspondence that led to this particular JIRA
—– Original Message —– From: Nitin
…
Another option I see at this point is you write a new class to start terracotta server which internally
…
—– Original Message —– From: Howard
Can the following patch be applied to
…
Index: TCServerImpl.java
*** TCServerImpl.java (revision 13491) — TCServerImpl.java (working copy) *************** *** 65,84 **** — 65,85 —- import com.tc.stats.DSOMBean; import com.tc.util.Assert;
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Date; import java.util.List;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.LinkedBlockingQueue;
import javax.management.InstanceAlreadyExistsException; import javax.management.MBeanRegistrationException; import javax.management.MBeanServer; import javax.management.NotCompliantMBeanException;
public class TCServerImpl extends SEDA implements TCServer {
public static final String VERSION_SERVLET_PATH = “/version”; *************** *** 204,247 **** — 205,252 —- if (!this.state.isStartState()) { stopServer(); logger.info(“Server stopped.”); } else { logger.warn(“Server in incorrect state (“ + this.state.getState() + “) to be stopped.”); } }
}
—–Original Message—– From: Howard
…
Turns out that the Apache procrun adapter … assumes the service has quit if the TCServerMain.main() method returns. When launched instead from java.exe, the JVM hangs around because of non-daemon threads.