You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by k9...@operamail.com on 2012/07/23 20:46:26 UTC

launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

I've built/installed Tomcat 7.0.29 from source on linux/64.

I've setup an init.d using jsvc launch, loosely based on the src-bundled
daemon.sh script.

@ tomcat service launch, using out-of-the-box config for now, I see two
listeners on ONE pid,

	netstat -pan --tcp | grep jsvc
		tcp        0      0 :::8080                 :::*        
		           LISTEN      30891/jsvc.exec
		tcp        0      0 :::8009                 :::*        
		           LISTEN      30891/jsvc.exec

but note that actually TWO procs/pids exist,

	ps ax | grep jsvc
		30890 ?        Ss     0:00 jsvc.exec -user tomcat
		-java-home /etc/alternatives/java_sdk -pidfile
		/var/run/tomcat7/tomcat7.pid -classpath
		/usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/local/tomcat7/build/bin/tomcat-juli.jar
		-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
		-Djava.util.logging.config.file=/usr/local/etc/tomcat7/conf/logging.properties
		-Djava.endorsed.dirs=
		-Dcatalina.base=/usr/local/tomcat7/build
		-Dcatalina.home=/usr/local/tomcat7/build
		-Djava.io.tmpdir=/var/tmp/tomcat7 -outfile
		/var/log/tomcat7/tomcat-initd.log -errfile &1 -wait 10
		org.apache.catalina.startup.Bootstrap

		30891 ?        Sl     0:03 jsvc.exec -user tomcat
		-java-home /etc/alternatives/java_sdk -pidfile
		/var/run/tomcat7/tomcat7.pid -classpath
		/usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/local/tomcat7/build/bin/tomcat-juli.jar
		-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
		-Djava.util.logging.config.file=/usr/local/etc/tomcat7/conf/logging.properties
		-Djava.endorsed.dirs=
		-Dcatalina.base=/usr/local/tomcat7/build
		-Dcatalina.home=/usr/local/tomcat7/build
		-Djava.io.tmpdir=/var/tmp/tomcat7 -outfile
		/var/log/tomcat7/tomcat-initd.log -errfile &1 -wait 10
		org.apache.catalina.startup.Bootstrap

I want only a *single* instance of tomcat running.

Seeing these TWO pids, is that actually TWO instaces?

Reading @ https://commons.apache.org/daemon/jsvc.html

	How jsvc works
	Jsvc uses 3 processes: a launcher process, a controller process
	and a controlled process. ...

I suspect it's not, and I'm just seeing those ^^^, but wanted to get
some clarification.

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

Posted by Jeff Beard <je...@cyberxape.com>.
Sorry, I didn't read you email close enough and said something stupid. It
appears that you are not seeing multiple threads as procs rather I think
it's a jsvc parent/child pair. It looks like the output of 'ps ax' it
doesn't show the parent PID. I use ps -ef which shows the parent ID. Try
that and see if that's not the case.



On Mon, Jul 23, 2012 at 1:15 PM, <k9...@operamail.com> wrote:

> Hi
>
> On Mon, Jul 23, 2012, at 01:10 PM, Jeff Beard wrote:
> > ps is showing threads as processes, which occurs with some versions of
> > Linux kernel. The listeners are 2 different threads: an AJP on 8009 and
> > an
> > HTTP on 8080.
>
> Ok, so that sounds like one PID per thread, at least according to ps on
> this kernel?
>
> If the listeners are on 2 *different* threads, wouldn't they appear
> 'attached' to two *different* pids, then?
>
> Rather than the same?
>
> > >         netstat -pan --tcp | grep jsvc
> > >                 tcp        0      0 :::8080                 :::*
>  LISTEN      30891/jsvc.exec
> > >                 tcp        0      0 :::8009                 :::*
>  LISTEN      30891/jsvc.exec
>
> I'll admit not being certain of the real import of this displayed info,
> if any ...
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Jeff Beard
tel: 303 829 0105
fax: 320 923 0105
web: http://jeffbeard.org

Re: launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

Posted by k9...@operamail.com.
Hi

On Mon, Jul 23, 2012, at 01:10 PM, Jeff Beard wrote:
> ps is showing threads as processes, which occurs with some versions of
> Linux kernel. The listeners are 2 different threads: an AJP on 8009 and
> an
> HTTP on 8080.

Ok, so that sounds like one PID per thread, at least according to ps on
this kernel?

If the listeners are on 2 *different* threads, wouldn't they appear
'attached' to two *different* pids, then?

Rather than the same?

> >         netstat -pan --tcp | grep jsvc
> >                 tcp        0      0 :::8080                 :::*  LISTEN      30891/jsvc.exec
> >                 tcp        0      0 :::8009                 :::*  LISTEN      30891/jsvc.exec

I'll admit not being certain of the real import of this displayed info,
if any ...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

Posted by Jeff Beard <je...@cyberxape.com>.
ps is showing threads as processes, which occurs with some versions of
Linux kernel. The listeners are 2 different threads: an AJP on 8009 and an
HTTP on 8080.



On Mon, Jul 23, 2012 at 12:46 PM, <k9...@operamail.com> wrote:

> I've built/installed Tomcat 7.0.29 from source on linux/64.
>
> I've setup an init.d using jsvc launch, loosely based on the src-bundled
> daemon.sh script.
>
> @ tomcat service launch, using out-of-the-box config for now, I see two
> listeners on ONE pid,
>
>         netstat -pan --tcp | grep jsvc
>                 tcp        0      0 :::8080                 :::*
>                            LISTEN      30891/jsvc.exec
>                 tcp        0      0 :::8009                 :::*
>                            LISTEN      30891/jsvc.exec
>
> but note that actually TWO procs/pids exist,
>
>         ps ax | grep jsvc
>                 30890 ?        Ss     0:00 jsvc.exec -user tomcat
>                 -java-home /etc/alternatives/java_sdk -pidfile
>                 /var/run/tomcat7/tomcat7.pid -classpath
>
> /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/local/tomcat7/build/bin/tomcat-juli.jar
>
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
>
> -Djava.util.logging.config.file=/usr/local/etc/tomcat7/conf/logging.properties
>                 -Djava.endorsed.dirs=
>                 -Dcatalina.base=/usr/local/tomcat7/build
>                 -Dcatalina.home=/usr/local/tomcat7/build
>                 -Djava.io.tmpdir=/var/tmp/tomcat7 -outfile
>                 /var/log/tomcat7/tomcat-initd.log -errfile &1 -wait 10
>                 org.apache.catalina.startup.Bootstrap
>
>                 30891 ?        Sl     0:03 jsvc.exec -user tomcat
>                 -java-home /etc/alternatives/java_sdk -pidfile
>                 /var/run/tomcat7/tomcat7.pid -classpath
>
> /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/local/tomcat7/build/bin/tomcat-juli.jar
>
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
>
> -Djava.util.logging.config.file=/usr/local/etc/tomcat7/conf/logging.properties
>                 -Djava.endorsed.dirs=
>                 -Dcatalina.base=/usr/local/tomcat7/build
>                 -Dcatalina.home=/usr/local/tomcat7/build
>                 -Djava.io.tmpdir=/var/tmp/tomcat7 -outfile
>                 /var/log/tomcat7/tomcat-initd.log -errfile &1 -wait 10
>                 org.apache.catalina.startup.Bootstrap
>
> I want only a *single* instance of tomcat running.
>
> Seeing these TWO pids, is that actually TWO instaces?
>
> Reading @ https://commons.apache.org/daemon/jsvc.html
>
>         How jsvc works
>         Jsvc uses 3 processes: a launcher process, a controller process
>         and a controlled process. ...
>
> I suspect it's not, and I'm just seeing those ^^^, but wanted to get
> some clarification.
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

Posted by k9...@operamail.com.

> > No other instance of 'java', 'jsvc' or 'tomcat' in the output.
> 
> Hm. Re-reading the commons-daemon page, it looks like maybe the
> launcher process exits shortly after launch, leaving only two
> long-running processes: the controlling process (the one in the
> fork()/wait() loop) and the controlled process (the one that actually
> launches the JVM).
> 
> At any rate, there is no concern, here, that two instances of Tomcat
> have been launched.

Clear enough.  Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To whom it may concern,

On 7/23/12 4:37 PM, k9157@operamail.com wrote:
>> Try this:
>> 
>> $ ps afx
>> 
>> Then, look at the output for 'jsvc' and you should see *three*
>> linked processes. Since you only looked for 'jsvc' you aren't
>> seeing the expected 3rd process (which is actually the instance
>> of Tomcat you are so worried about).
> 
> I still see only two:
> 
> ps afx 20334 ?        Ss     0:00 jsvc.exec -user tomcat
> -java-home /etc/alternatives/java_sdk -pidfile
> /var/run/tomcat7/tomcat7.pid -classpath 
> /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/loca
>
> 
...
> 20335 ?        Sl     0:03  \_ jsvc.exec -user tomcat -java-home 
> /etc/alternatives/java_sdk -pidfile /var/run/tomcat7/tomcat7.pid 
> -classpath 
> /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/
>
> 
...
> 
> No other instance of 'java', 'jsvc' or 'tomcat' in the output.

Hm. Re-reading the commons-daemon page, it looks like maybe the
launcher process exits shortly after launch, leaving only two
long-running processes: the controlling process (the one in the
fork()/wait() loop) and the controlled process (the one that actually
launches the JVM).

At any rate, there is no concern, here, that two instances of Tomcat
have been launched.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlANv5cACgkQ9CaO5/Lv0PAv5QCgg147wMKReJsc6L6oHZa4iNUQ
YrsAn1UXN6du4wh5/p0rrLpPR0KcYE1j
=+9QX
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

Posted by k9...@operamail.com.

On Mon, Jul 23, 2012, at 04:15 PM, Christopher Schultz wrote:
> > netstat -pan --tcp | grep jsvc tcp        0      0 :::8080
> > :::* LISTEN      30891/jsvc.exec tcp        0      0 :::8009
> > :::* LISTEN      30891/jsvc.exec
> 
> jsvc's job is to allow the controlled process to open ports, so all
> ports will owned by the controlling process.

Clear, now.

> > I want only a *single* instance of tomcat running.
> 
> Don't worry, you only have a single instance of Tomcat running. If you
> had multiple instances running, you'd have a port conflict, right?
> 
> Try this:
> 
> $ ps afx
> 
> Then, look at the output for 'jsvc' and you should see *three* linked
> processes. Since you only looked for 'jsvc' you aren't seeing the
> expected 3rd process (which is actually the instance of Tomcat you are
> so worried about).

I still see only two:

ps afx 
 20334 ?        Ss     0:00 jsvc.exec -user tomcat -java-home
 /etc/alternatives/java_sdk -pidfile /var/run/tomcat7/tomcat7.pid
 -classpath
 /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/loca
 ...
 20335 ?        Sl     0:03  \_ jsvc.exec -user tomcat -java-home
 /etc/alternatives/java_sdk -pidfile /var/run/tomcat7/tomcat7.pid
 -classpath
 /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/
 ...

No other instance of 'java', 'jsvc' or 'tomcat' in the output.

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: launching Tomcat7 with jsvc. Want only one Tomcat instance, but 'ps' shows two -- or does it?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

To whom it mat concern,

On 7/23/12 2:46 PM, k9157@operamail.com wrote:
> I've built/installed Tomcat 7.0.29 from source on linux/64.

Why did you bother to build Tomcat at all? I can see building the
daemon component, but building Tomcat itself is just a waste of time.

> I've setup an init.d using jsvc launch, loosely based on the
> src-bundled daemon.sh script.
> 
> @ tomcat service launch, using out-of-the-box config for now, I see
> two listeners on ONE pid,
> 
> netstat -pan --tcp | grep jsvc tcp        0      0 :::8080
> :::* LISTEN      30891/jsvc.exec tcp        0      0 :::8009
> :::* LISTEN      30891/jsvc.exec

jsvc's job is to allow the controlled process to open ports, so all
ports will owned by the controlling process.

> but note that actually TWO procs/pids exist,
> 
> ps ax | grep jsvc 30890 ?        Ss     0:00 jsvc.exec -user
> tomcat -java-home /etc/alternatives/java_sdk -pidfile 
> /var/run/tomcat7/tomcat7.pid -classpath 
> /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/local/tomcat7/build/bin/tomcat-juli.jar
>
> 
- -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> -Djava.util.logging.config.file=/usr/local/etc/tomcat7/conf/logging.properties
>
> 
- -Djava.endorsed.dirs=
> -Dcatalina.base=/usr/local/tomcat7/build 
> -Dcatalina.home=/usr/local/tomcat7/build 
> -Djava.io.tmpdir=/var/tmp/tomcat7 -outfile 
> /var/log/tomcat7/tomcat-initd.log -errfile &1 -wait 10 
> org.apache.catalina.startup.Bootstrap
> 
> 30891 ?        Sl     0:03 jsvc.exec -user tomcat -java-home
> /etc/alternatives/java_sdk -pidfile /var/run/tomcat7/tomcat7.pid
> -classpath 
> /usr/local/tomcat7/build/bin/bootstrap.jar:/usr/local/tomcat7/build/bin/commons-daemon.jar:/usr/local/tomcat7/build/bin/tomcat-juli.jar
>
> 
- -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> -Djava.util.logging.config.file=/usr/local/etc/tomcat7/conf/logging.properties
>
> 
- -Djava.endorsed.dirs=
> -Dcatalina.base=/usr/local/tomcat7/build 
> -Dcatalina.home=/usr/local/tomcat7/build 
> -Djava.io.tmpdir=/var/tmp/tomcat7 -outfile 
> /var/log/tomcat7/tomcat-initd.log -errfile &1 -wait 10 
> org.apache.catalina.startup.Bootstrap
> 
> I want only a *single* instance of tomcat running.

Don't worry, you only have a single instance of Tomcat running. If you
had multiple instances running, you'd have a port conflict, right?

Try this:

$ ps afx

Then, look at the output for 'jsvc' and you should see *three* linked
processes. Since you only looked for 'jsvc' you aren't seeing the
expected 3rd process (which is actually the instance of Tomcat you are
so worried about).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlANsNgACgkQ9CaO5/Lv0PCa3QCfR9gyw6HLIG/FhbB08qHNGInK
FBAAoIXqMtjjaHf8FPWqbGGnSZqc3o8L
=VFcM
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org