#1 wrapper.pidfile in WrapperService

open
nobody
None
5
2010-10-04
2010-07-16
Anonymous
No

I'm using yajsw-beta-10.2. I created 2 windows services with yajsw in order to stop/start each other. I'm using the following code:

String currentConfiguration = System.getProperty("wrapper.config");

System.setProperty("wrapper.config", "wrapper1.conf");
//or System.setProperty("wrapper.config", "wrapper2.conf");

WrappedService w = new WrappedService();
w.init();
w.start();

System.setProperty("wrapper.config", currentConfiguration);

It works fine on windows, but when I try to use it on Linux the daemon doesn't start. One of the daemons stops the other one but when it tries to start the log says "INFO: already running".

As I am using two services there are 2 pid files. I think the problem is because yajsw don't get the correct pidName. You can see it printing pidName in PosixService.init().

pidName = _config.getString("wrapper.pidfile", new File(pidDir, "wrapper." + getName() + ".pid").getCanonicalPath());

As I'm using the default wrapper.pidfile I did the following modification:

pidName = new File(pidDir, "wrapper." + getName() + ".pid").getCanonicalPath();

Now it works fine, but I know the modification isn't correct. When you load the configuration(_config) in WrapperService.init() you don't update "wrapper.pidfile". Could you please let me know I'm wrong?

Thanks in advance

Alex

Discussion

  • rzo
    rzo
    2010-07-16

    could you pls post or attach both conf files and the log files of both services.

    thanks

    ron

     
  • rzo
    rzo
    2010-07-16

    • status: open --> pending
     

  • Anonymous
    2010-07-16

    #################################################################

    wrapper.agent.dir=/home/acesarino/agent
    wrapper.agent.tempdir=${wrapper.agent.dir}/tmp
    wrapper.agent.port=1101
    wrapper.agent.type=PRINCIPAL
    wrapper.java.command=${wrapper.agent.dir}/jre6/bin/java
    wrapper.working.dir=${wrapper.agent.dir}
    wrapper.logfile=${wrapper.working.dir}/logs/agent.log
    wrapper.java.app.mainclass=br.com.gaea.agent.server.Services
    wrapper.console.loglevel=INFO
    wrapper.console.title=CerberonAgent
    wrapper.ntservice.name=CerberonAgent
    wrapper.ntservice.displayname=CerberonAgent
    wrapper.ntservice.description=
    wrapper.tray = true
    wrapper.on_exit.0=SHUTDOWN
    wrapper.on_exit.default=RESTART
    wrapper.filter.trigger.0=Exception
    wrapper.filter.script.0=scripts\/trayMessage.gv
    wrapper.filter.script.0.args=Exception
    placeHolderSoGenPropsComeHere=
    wrapper.app.parameter.1 = -home
    wrapper.app.parameter.2 = ${wrapper.agent.dir}
    wrapper.app.parameter.3 = -port
    wrapper.app.parameter.4 = ${wrapper.agent.port}
    wrapper.app.parameter.5 = -type
    wrapper.app.parameter.6 = ${wrapper.agent.type}
    wrapper.app.parameter.7 = -tempDir
    wrapper.app.parameter.8 = ${wrapper.agent.tempdir}
    wrapper.app.parameter.9 = -debug
    wrapper.java.classpath.1 = .
    wrapper.java.classpath.2 = ${wrapper.working.dir}/lib/agent-server.jar
    wrapper.java.classpath.3 = ${wrapper.working.dir}/lib/hsqldb-1.8.0.10.jar
    wrapper.java.classpath.4 = ${wrapper.agent.dir}/jsw/wrapper.jar
    wrapper.java.classpath.5 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-cli-2.jar
    wrapper.java.classpath.6 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-collections-3.2.jar
    wrapper.java.classpath.7 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-lang-2.4.jar
    wrapper.java.classpath.8 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-logging-1.1.jar
    wrapper.java.classpath.9 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-vfs-2.0-SNAPSHOT.jar
    wrapper.java.classpath.10 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-configuration-1.7-SNAPSHOT.jar
    wrapper.java.classpath.11 = ${wrapper.agent.dir}/jsw/lib/core/groovy/groovy-all-1.6.4.jar
    wrapper.java.classpath.12 = ${wrapper.agent.dir}/jsw/lib/core/jna/jna.jar
    wrapper.java.classpath.13 = ${wrapper.agent.dir}/jsw/lib/extended/velocity/velocity-1.5.jar
    wrapper.debug=false
    ##############################################################
    wrapper.agent.dir=/home/acesarino/agent
    wrapper.agent.tempdir=${wrapper.agent.dir}/tmp
    wrapper.agent.port=11001
    wrapper.agent.type=ADMINISTRATION
    wrapper.java.command=${wrapper.agent.dir}/jre6/bin/java
    wrapper.working.dir=${wrapper.agent.dir}/update
    wrapper.logfile=${wrapper.working.dir}/logs/agent.log
    wrapper.java.app.mainclass=br.com.gaea.agent.server.Services
    wrapper.console.loglevel=INFO
    wrapper.console.title=CerberonAdm
    wrapper.ntservice.name=CerberonAdm
    wrapper.ntservice.displayname=CerberonAdm
    wrapper.ntservice.description=
    wrapper.tray = true
    wrapper.on_exit.0=SHUTDOWN
    wrapper.on_exit.default=RESTART
    wrapper.filter.trigger.0=Exception
    wrapper.filter.script.0=scripts\/trayMessage.gv
    wrapper.filter.script.0.args=Exception
    placeHolderSoGenPropsComeHere=
    wrapper.app.parameter.1 = -home
    wrapper.app.parameter.2 = ${wrapper.agent.dir}
    wrapper.app.parameter.3 = -port
    wrapper.app.parameter.4 = ${wrapper.agent.port}
    wrapper.app.parameter.5 = -type
    wrapper.app.parameter.6 = ${wrapper.agent.type}
    wrapper.app.parameter.7 = -tempDir
    wrapper.app.parameter.8 = ${wrapper.agent.tempdir}
    wrapper.java.classpath.1 = .
    wrapper.java.classpath.2 = ${wrapper.working.dir}/lib/agent-server.jar
    wrapper.java.classpath.3 = ${wrapper.working.dir}/lib/hsqldb-1.8.0.10.jar
    wrapper.java.classpath.4 = ${wrapper.agent.dir}/jsw/wrapper.jar
    wrapper.java.classpath.5 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-cli-2.jar
    wrapper.java.classpath.6 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-collections-3.2.jar
    wrapper.java.classpath.7 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-lang-2.4.jar
    wrapper.java.classpath.8 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-logging-1.1.jar
    wrapper.java.classpath.9 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-vfs-2.0-SNAPSHOT.jar
    wrapper.java.classpath.10 = ${wrapper.agent.dir}/jsw/lib/core/commons/commons-configuration-1.7-SNAPSHOT.jar
    wrapper.java.classpath.11 = ${wrapper.agent.dir}/jsw/lib/core/groovy/groovy-all-1.6.4.jar
    wrapper.java.classpath.12 = ${wrapper.agent.dir}/jsw/lib/core/jna/jna.jar
    wrapper.java.classpath.13 = ${wrapper.agent.dir}/jsw/lib/extended/velocity/velocity-1.5.jar
    wrapper.debug=false
    ##############################################################
    INFO|wrapper|10-07-16 11:03:30|set state IDLE->STARTING
    INFO|wrapper|10-07-16 11:03:30|starting Process
    INFO|wrapper|10-07-16 11:03:31|Controller State: UNKNOWN -> WAITING
    INFO|wrapper|10-07-16 11:03:31|working dir /home/acesarino/agent
    INFO|wrapper|10-07-16 11:03:31|found script scripts/trayMessage.gv
    INFO|wrapper|10-07-16 11:03:31|exec:/home/acesarino/agent/jre6/bin/java -classpath /home/acesarino/agent/jsw/./wrapperApp.jar:/home/acesarino/agent:/home/acesarino/agent/lib/agent-server.jar:/home/acesarino/agent/lib/hsqldb-1.8.0.10.jar:/home/acesarino/agent/jsw/wrapper.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-cli-2.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-collections-3.2.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-lang-2.4.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-logging-1.1.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-vfs-2.0-SNAPSHOT.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-configuration-1.7-SNAPSHOT.jar:/home/acesarino/agent/jsw/lib/core/groovy/groovy-all-1.6.4.jar:/home/acesarino/agent/jsw/lib/core/jna/jna.jar:/home/acesarino/agent/jsw/lib/extended/velocity/velocity-1.5.jar -Xrs -Dwrapper.service=true -Dwrapper.console.visible=false -Dwrapper.visible=false -Dwrapper.pidfile=/var/run/wrapper.CerberonAgent.pid -Dwrapper.config=/home/acesarino/agent/jsw/conf/wrapper.conf -Dwrapper.port=15004 -Dwrapper.key=5095522246859547047 -Dwrapper.teeName=5095522246859547047$1279289011297 -Dwrapper.tmpPath=/tmp org.rzo.yajsw.app.WrapperJVMMain
    INFO|wrapper|10-07-16 11:03:32|started process 4135
    INFO|wrapper|10-07-16 11:03:32|started process with pid 4135
    INFO|wrapper|10-07-16 11:03:32|set state STARTING->RUNNING
    INFO|4135/0|10-07-16 11:03:33|Jul 16, 2010 11:03:33 AM org.apache.commons.vfs.VfsLog info
    INFO|4135/0|10-07-16 11:03:33|INFO: Using "/tmp/vfs_cache" as temporary files store.
    INFO|4135/0|10-07-16 11:03:33|external stop false
    INFO|4135/0|10-07-16 11:03:33|Controller State: WAITING -> ESTABLISHED
    INFO|4135/0|10-07-16 11:03:33|Controller State: ESTABLISHED -> LOGGED_ON
    INFO|wrapper|10-07-16 11:08:09|set state RUNNING->STATE_USER_STOP
    INFO|wrapper|10-07-16 11:08:09|stopping process with pid/timeout 4135 45000
    INFO|4135/0|10-07-16 11:08:09|Controller State: LOGGED_ON -> WAITING_CLOSED
    INFO|4135/0|10-07-16 11:08:09|wrapper manager received stop command
    INFO|4135/0|10-07-16 11:08:09|Controller State: WAITING_CLOSED -> USER_STOP
    INFO|wrapper|10-07-16 11:08:09|stop config name null
    INFO|wrapper|10-07-16 11:08:09|externalStop false
    INFO|wrapper|10-07-16 11:08:09|exit code linux process 0
    INFO|4135/0|10-07-16 11:08:09|Controller State: USER_STOP -> PROCESS_KILLED
    INFO|wrapper|10-07-16 11:08:09|set state STATE_USER_STOP->IDLE
    INFO|wrapper|10-07-16 11:08:09|killing 4135
    INFO|4135/0|10-07-16 11:08:10|gobler execption OUTPUT 4135 null
    INFO|4135/0|10-07-16 11:08:10|gobler execption ERROR 4135 null
    INFO|wrapper|10-07-16 11:08:10|process exit code: 0
    INFO|4135/0|10-07-16 11:08:10|gobler terminated OUTPUT 4135
    INFO|wrapper|10-07-16 11:08:10|set state IDLE->STATE_SHUTDOWN
    INFO|4135/0|10-07-16 11:08:10|gobler terminated ERROR 4135
    ################################################################
    INFO|wrapper|10-07-16 11:02:56|set state IDLE->STARTING
    INFO|wrapper|10-07-16 11:02:56|starting Process
    INFO|wrapper|10-07-16 11:02:56|Controller State: UNKNOWN -> WAITING
    INFO|wrapper|10-07-16 11:02:56|working dir /home/acesarino/agent/update
    INFO|wrapper|10-07-16 11:02:56|found script scripts/trayMessage.gv
    INFO|wrapper|10-07-16 11:02:56|exec:/home/acesarino/agent/jre6/bin/java -classpath /home/acesarino/agent/jsw/./wrapperApp.jar:/home/acesarino/agent/update:/home/acesarino/agent/update/lib/agent-server.jar:/home/acesarino/agent/update/lib/hsqldb-1.8.0.10.jar:/home/acesarino/agent/jsw/wrapper.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-cli-2.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-collections-3.2.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-lang-2.4.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-logging-1.1.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-vfs-2.0-SNAPSHOT.jar:/home/acesarino/agent/jsw/lib/core/commons/commons-configuration-1.7-SNAPSHOT.jar:/home/acesarino/agent/jsw/lib/core/groovy/groovy-all-1.6.4.jar:/home/acesarino/agent/jsw/lib/core/jna/jna.jar:/home/acesarino/agent/jsw/lib/extended/velocity/velocity-1.5.jar -Xrs -Dwrapper.service=true -Dwrapper.console.visible=false -Dwrapper.visible=false -Dwrapper.pidfile=/var/run/wrapper.CerberonAdm.pid -Dwrapper.config=/home/acesarino/agent/jsw/conf/wrapper.update.conf -Dwrapper.port=15003 -Dwrapper.key=3878233931989811732 -Dwrapper.teeName=3878233931989811732$1279288976329 -Dwrapper.tmpPath=/tmp org.rzo.yajsw.app.WrapperJVMMain
    INFO|wrapper|10-07-16 11:02:57|started process 4084
    INFO|wrapper|10-07-16 11:02:57|started process with pid 4084
    INFO|wrapper|10-07-16 11:02:57|set state STARTING->RUNNING
    INFO|4084/0|10-07-16 11:02:58|Jul 16, 2010 11:02:58 AM org.apache.commons.vfs.VfsLog info
    INFO|4084/0|10-07-16 11:02:58|INFO: Using "/tmp/vfs_cache" as temporary files store.
    INFO|4084/0|10-07-16 11:02:58|external stop false
    INFO|4084/0|10-07-16 11:02:58|Controller State: WAITING -> ESTABLISHED
    INFO|4084/0|10-07-16 11:02:58|Controller State: ESTABLISHED -> LOGGED_ON
    INFO|4084/0|10-07-16 11:02:58|Cerberon Agent 2.3.1-b311 running on port 11001
    INFO|4084/0|10-07-16 11:08:07|Jul 16, 2010 11:08:07 AM org.apache.commons.vfs.VfsLog info
    INFO|4084/0|10-07-16 11:08:07|INFO: Using "/tmp/vfs_cache" as temporary files store.
    INFO|4084/0|10-07-16 11:08:07|Jul 16, 2010 11:08:07 AM org.rzo.yajsw.os.posix.PosixService init
    INFO|4084/0|10-07-16 11:08:07|INFO: /etc/init.d/CerberonAgent already exists
    INFO|4084/0|10-07-16 11:08:16|rudi 0
    INFO|4084/0|10-07-16 11:08:16|Jul 16, 2010 11:08:16 AM org.rzo.yajsw.os.posix.PosixService stop
    INFO|4084/0|10-07-16 11:08:16|INFO: Stopping CerberonAgent ...
    INFO|4084/0|10-07-16 11:08:16|rudi 0
    INFO|4084/0|10-07-16 11:08:16|done
    INFO|4084/0|10-07-16 11:08:16|
    INFO|4084/0|10-07-16 11:08:16|Jul 16, 2010 11:08:16 AM org.rzo.yajsw.os.posix.PosixService getPid
    INFO|4084/0|10-07-16 11:08:16|INFO: wrapper pid file: /var/run/wrapper.CerberonAdm.pid
    INFO|4084/0|10-07-16 11:08:21|Jul 16, 2010 11:08:21 AM org.rzo.yajsw.os.posix.PosixService init
    INFO|4084/0|10-07-16 11:08:21|INFO: /etc/init.d/CerberonAgent already exists
    INFO|4084/0|10-07-16 11:08:21|Jul 16, 2010 11:08:21 AM org.rzo.yajsw.os.posix.PosixService getPid
    INFO|4084/0|10-07-16 11:08:21|INFO: wrapper pid file: /var/run/wrapper.CerberonAdm.pid
    INFO|4084/0|10-07-16 11:08:21|rudi 0
    INFO|4084/0|10-07-16 11:08:21|Jul 16, 2010 11:08:21 AM org.rzo.yajsw.os.posix.PosixService start
    INFO|4084/0|10-07-16 11:08:21|INFO: already running

     

  • Anonymous
    2010-07-16

    • status: pending --> open
     
  • rzo
    rzo
    2010-07-26

    Hello,

    pls change your source as follows:

    WrappedService w = new WrappedService();

    // use only local configuration
    w.getLocalConfiguration().setProperty("wrapper.config", "wrapper1.config");

    // do not inherit properties from parent
    w.setUseSystemProperties(false);

    w.start();

    I think this should solve the issue.
    The problem is, that with Linux, most parameters are passed to the sub process through the command line. Since command line properties override config file properties. So when cascading YAJSW, one should not use system properties, but local properties and one should "tell yajsw" not to use the system properties.

    This is mentioned in the docs, but maybe it is not clear enough.

    I will have to extend the docs in future.

    Please check this out and confirm that this solves your issue.

    -- Ron

    PS: sorry for the delayed answer. I was on travel.

     
  • rzo
    rzo
    2010-07-26

    • status: open --> pending
     
  • This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending --> closed
     
  • rzo
    rzo
    2010-10-04

    the issue is open again. sorry.

    have you tried the changes i proposed ?

    -- ron

     
  • rzo
    rzo
    2010-10-04

    • status: closed --> open