Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Why does my Tomcat start up multiple copies in Windows 10 Sservices?

 
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For Eclipse to work, I often have to hop onto services to kill the Tomcat processes, start Tomcat again in Eclipse and then run the servlet.

Is there a reason why Tomcat start multiple copies with same Process-ID but 4 different ports? See attached image.

P.S. I am running TCat 9.0.46 on Eclipse 2021-06
MultipleTomcats.JPG
4 copies of Tomcat
4 copies of Tomcat
 
Master Rancher
Posts: 4457
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you get that display shown in the image you posted?
How many connections have been made to the 127.0.0.1 port on TC?
 
Saloon Keeper
Posts: 24188
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I could swear that that display says that Tomcat is talking to itself.

Those are not standard Tomcat ports, so I'd look to see if there's something running inside Tomcat that's doing a little networking of its own.
 
Tim Holloway
Saloon Keeper
Posts: 24188
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, a quick check indicates that these connections may be coming from svchost and that they are in aid of special Windows-only network features.

There's only one Tomcat running, but even on non-Windows machines, Tomcat listens on several ports. Generally 8080, 8443, 8009 and 8005, I think and possible yet one other...
 
Marshal
Posts: 3644
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:How do you get that display shown in the image you posted?


Looks like a netstat-like view using CurrPorts.
 
Ron McLeod
Marshal
Posts: 3644
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

AhFai Chan wrote:Is there a reason why Tomcat start multiple copies with same Process-ID but 4 different ports?


The image is showing 1 instance of Tomcat with 4 connections.
 
Ron McLeod
Marshal
Posts: 3644
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This post in the tomcat-users mailing list might answer your question: Why does Tomcat open connections on localhost?
 
AhFai Chan
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:How do you get that display shown in the image you posted?
How many connections have been made to the 127.0.0.1 port on TC?




One process-id, four ports
 
AhFai Chan
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:OK, a quick check indicates that these connections may be coming from svchost and that they are in aid of special Windows-only network features.

There's only one Tomcat running, but even on non-Windows machines, Tomcat listens on several ports. Generally 8080, 8443, 8009 and 8005, I think and possible yet one other...



So nothing I need to be concerned about, just TCat listening on 4 ports???

Is there some config file where I can limit the number of ports TCat can listen on?
 
AhFai Chan
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ron McLeod wrote:This post in the tomcat-users mailing list might answer your question: Why does Tomcat open connections on localhost?



Thanks for the link.

About GC mentioned in the article, I found that those connections are "sticky". Sometimes I have to manually kill the process. otherwise, Eclipse will throw an error message saying somthing about the port already in use. During installation I used the default socket 127.0.0.1:8080. It seems I can't do that in Eclipse.

Is there some config file where I can limit the number of ports that TCat listens on?

 
Marshal
Posts: 22392
121
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:I could swear that that display says that Tomcat is talking to itself.


That's what it looks like to me to. In fact, the first 6 entries are all pairs of two, including the expressvpnd entries.

Ron McLeod wrote:

Norm Radder wrote:How do you get that display shown in the image you posted?


Looks like a netstat-like view using CurrPorts.


Either that or TcpView.
 
Tim Holloway
Saloon Keeper
Posts: 24188
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

AhFai Chan wrote:
Is there some config file where I can limit the number of ports that TCat listens on?



Yes. It's the TOMCAT_HOME/conf/server.xml file and Tomcat only listens to the ports indicated in Connector elements.

However, it appears that "Tomcat" isn't listening on these rogue ports, so Tomcat cannot configure them. If it's nio, then you could only shut them up by using alternatives to nio (say, traditional Java I/O).

I'm no expert on nio, but Tomcat's primary ports cannot be non-blocking since the protocols that they implement expect to block. You cannot expect an HTTP response from an HTTP request before the webapp has received the entire request and had a chance to chew on it, for example. I won't vouch for websocket operations, but it's just not conformant with standard HTTP.

I can't think offhand for that matter of any case where Tomcat itself would internally need nio. If it is, it's probably in plug-ins to Tomcat such as back-end services, maybe better performance writing logs, and so forth. So the primary place I'd look for nio activity would be in the webapps themselves.

In any event, using 4 or 6 extra ports isn't likely to hurt anybody. It's only if the port consumption spirals out of control that you should worry. Since there's only a finite set of ports and they're all shared across the entire OS, runaway port consumption could crash not merely Tomcat, but any other system service using network connections. And ultimately probably the OS itself.
 
AhFai Chan
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:

Tim Holloway wrote:I could swear that that display says that Tomcat is talking to itself.


That's what it looks like to me to. In fact, the first 6 entries are all pairs of two, including the expressvpnd entries.

Ron McLeod wrote:

Norm Radder wrote:How do you get that display shown in the image you posted?


Looks like a netstat-like view using CurrPorts.


Either that or TcpView.




I used TCPView
 
AhFai Chan
Ranch Hand
Posts: 244
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, the webapps do use HttpServletResponse and HttpServletRequest.
I think I'll just accept that TCat is using 4 ports if it is not degrading the system performance. Handling this is a bridge too far for me for now.
 
Tim Holloway
Saloon Keeper
Posts: 24188
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

AhFai Chan wrote:Thanks, the webapps do use HttpServletResponse and HttpServletRequest.



I'm sure that they do. But there's nothing that says that a webapp cannot use nio for its internal I/O needs if it wants to. At least that I've ever heard.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic