Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Guido Jäkel



On 2020-03-31 15:34, Mark Thomas wrote:
> On 31/03/2020 13:49, Aditya Kumar wrote:
>> Hi Mark,
>>
>> Sorry I'm not familiar with what a Selector is? However on one system I've
>> noticed 28000 such connections. Are these caused by client connections? I'm
>> not saying the connection originates from a client, but does the type of
>> socket get create because of client connections?
> 
> A selector is what a NIO Connector uses to "select" the socket
> connections that have data waiting to be processed out of all of the
> current connections. I'd expect a 1:1 mapping between Selectors and
> Tomcat Connectors. (It might be 2:1 to n+1:n I'd need to look at the
> code to be sure but it will be driven by listening sockets on Tomcat,
> not client connections.
> 
> It looks like something is creating selectors but not destroying them.
> That might be Tomcat code but at those numbers I think the application
> is more likely.
> 
> I recommend using a profiler to track the current number of Selectors
> and trying to work out what triggers the creation of a new one.
> 
> Mark
> 
> 
>>
>> On Tue, Mar 31, 2020 at 1:20 PM Mark Thomas  wrote:
>>
>>> On 31/03/2020 11:20, Aditya Kumar wrote:
 Tomcat 9.0.30 on Windows Server 2012 / Java 1.8

 I've noticed on a freshly installed version of tomcat 9, upon startup
>>> there
 are several connections to and from localhost on different ports

 For example on my tomcat server there are 4 connections to and from
 localhost (output from netstat)

  TCP0.0.0.0:8080   0.0.0.0:0  LISTENING
>>>  3972
  TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED
>>>  3972
  TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED
>>>  3972
  TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED
>>>  3972
  TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED
>>>  3972
  TCP[::]:8080  [::]:0 LISTENING
>>>  3972

 These can grow to a large number (several thousand) on a busy system.
>>> What
 are these connections used for? What caused them? What thread are they
 attributed to?
>>>
>>> The Java NIO implementation on Windows uses TCP for intra-process
>>> signalling. It opens a pair of self-connected sockets for every Selector.
>>>
>>> Mark

Dear Aditya, dear all,

it's also an effect from using "modern" Java stream I/O. You might notice (by 
consulting /proc/$N/fd/) even pipe handles in addition to the socket handles. 
The worse thing I discovered that they are not necessarily released by a minor 
garbage collection (after the corresponding java "instrument" is out-of-scope) 
but may be even remain until a full gc is running! And if you're using the 
up-to-date G1 GC, then -- as an explicit aim of design -- this will run very 
seldom.

For my Tomcat (and Wildfly) instances of our "Java Application platform" I was 
forced to increase the (container) file descriptor limit a lot and in addition 
to write a watchdog which will fire an forced full GC on the JVM (via 'jcmd 
$PID GC.run') in case the number of fd is approaching the limit. This is 
because the Java heap is independed to the OS file descriptor resources and 
might not be become collected in the right time because the corresponding 
memory occupation of the related objects on the Java heap is typical right 
small.


greetings

Guido

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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

John,

On 3/31/20 10:37, John Dale wrote:
> I always appreciate your depth of knowledge, Chris.
>
> "hand-wavy device supporting NIO for Java"
>
> Could you write us a quick paragraph expanding on this idea?
>
> I'm happy to follow a pointer to a well written article (something
> up to your standards).

I mostly called it "hand-wavy" because I do not understand it myself:
it's indistinguishable from magic from my perspective. At least at the
kernel-level.

Mark or others may be able to intervene and tell me I'm wrong, but it
seems like Java's NIO ("new IO") is nothing new: the standard C
library from 1970 contains the select() function which is exactly what
a Selector does. It takes a whole bunch of I/O channels and waits for
one of them to have activity, returning the set of channels with
activity that the caller can then handle.

Imagine writing "telnet" in Java with only java.io.InputStream and
java.io.OutputStream. First, you'd connect to the telnet server and
probably wait for some input like a password challenge, using
InputStream.read() for some reasonable time. But how do you know when
the "password prompt" is done? Maybe there is more input.
InputStream.read has a read-timeout, but it will block until there's
data or EOF (or timeout). There's no signalling that can be done from
server to client or vice versa.

Let's forget about login. What about sitting at command-line? Do you
sit there blocking on the InputStream listening for client input (e.g.
keyboard) or the InputStream from the server waiting for server input
(e.g. "System going down for maintenance in 10:00!")?

You just can't do it.

So with a Selector, you grab the channels for all those things (e.g.
keyboard, server), and say "hey, selector, I don't care whose ready
next, but let me know when something interesting happens". The
selector waits for EITHER the keyboard OR the server to provide input,
and then the thread waiting on the selector wakes up and gets the
message: "keyboard has data" and you handle it (probably by sending
that data to the server)". Or maybe it was "server has data" and you
print it to the screen. The point is that, with a Selector, you can
actually implement something like telnet where with, uh, "old IO" you
could not practically implement it.

This takes us back to the magic: for some reason, OS kernels need to
create a structure to use for the selector under the covers. [I did my
TCP/IP university work long ago, and don't ever remember discussing or
even noticing any domain socket being set up when a select() was being
called, but that may just be because it wasn't important to us at that
point -- an implementation detail.] Windows versus Linux choose to do
those things in different ways with different manifestations. Why do
they need it? Why did they choose those specific manifestations? I
have no idea. Go ask Ken Thompson or Dennis Richie (RIP). Or
serverfault. The information is out there. I can't give you a
canonical source myself.

If someone wants to provide a good reference, I'd love to read it myself
.

- -chris

> On 3/31/20, Christopher Schultz 
> wrote: Frank,
>
> On 3/31/20 09:30, Frank Tornack wrote:
 Yes, these too are for communication between processes. Only
 you don't use the network stack. This is a special feature of
 Unix-like operating systems.

 DGRAM, unlike STREAM, does not know connection states.
 Therefore STREAM is comparable to a local TCP connection.
 Unix domain sockets exist in the file tree as special files.
 Access is controlled by file permissions, as is usual for
 files.
>
> Yup. It's helpful to see the column headers for your netstat
> output, André:
>
 Proto RefCnt Flags   Type   State I-Node
 PID/Program name Path unix  2  [ ] STREAM
 CONNECTED 167427210 27514/java unix  2  [ ]
 STREAM CONNECTED 167423436 27514/java
>
> Each "unix" protocol-connection (UNIX domain socket) has an
> associated inode on the root filesystem, but no path. Basically,
> it's magic. :)
>
> The nice thing on *NIX is that even though there is a hand-wavy
> device supporting NIO for Java, it doesn't consume pairs of ports
> (which are a limited resource; see our recent discussion on the
> limits of TCP port numbers).
>
> -chris
>
 Am Dienstag, den 31.03.2020, 14:29 +0200 schrieb André
 Warnier (tomcat/perl):
> On 31.03.2020 14:20, Mark Thomas wrote:
>> On 31/03/2020 11:20, Aditya Kumar wrote:
>>> Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
>>>
>>> I've noticed on a freshly installed version of tomcat
>>> 9, upon startup there are several connections to and
>>> from localhost on different ports
>>>
>>> For example on my tomcat server there are 4 connections
>>> to and from localhost (output from netstat)
>>>
>>>
>>> TCP0.0.0.0:8080   0.0.0.0:0 LISTENING 3972
>>>
>>> TCP

Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread John Dale
I always appreciate your depth of knowledge, Chris.

"hand-wavy device supporting NIO for Java"

Could you write us a quick paragraph expanding on this idea?

I'm happy to follow a pointer to a well written article (something up
to your standards).

On 3/31/20, Christopher Schultz  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Frank,
>
> On 3/31/20 09:30, Frank Tornack wrote:
>> Yes, these too are for communication between processes. Only you
>> don't use the network stack. This is a special feature of Unix-like
>> operating systems.
>>
>> DGRAM, unlike STREAM, does not know connection states. Therefore
>> STREAM is comparable to a local TCP connection. Unix domain sockets
>> exist in the file tree as special files. Access is controlled by
>> file permissions, as is usual for files.
>
> Yup. It's helpful to see the column headers for your netstat output,
> André:
>
>> Proto RefCnt Flags   Type   State I-Node
>> PID/Program name Path unix  2  [ ] STREAM
>> CONNECTED 167427210 27514/java unix  2  [ ] STREAM
>> CONNECTED 167423436 27514/java
>
> Each "unix" protocol-connection (UNIX domain socket) has an associated
> inode on the root filesystem, but no path. Basically, it's magic. :)
>
> The nice thing on *NIX is that even though there is a hand-wavy device
> supporting NIO for Java, it doesn't consume pairs of ports (which are
> a limited resource; see our recent discussion on the limits of TCP
> port numbers).
>
> - -chris
>
>> Am Dienstag, den 31.03.2020, 14:29 +0200 schrieb André Warnier
>> (tomcat/perl):
>>> On 31.03.2020 14:20, Mark Thomas wrote:
 On 31/03/2020 11:20, Aditya Kumar wrote:
> Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
>
> I've noticed on a freshly installed version of tomcat 9,
> upon startup there are several connections to and from
> localhost on different ports
>
> For example on my tomcat server there are 4 connections to
> and from localhost (output from netstat)
>
>
> TCP0.0.0.0:8080   0.0.0.0:0
> LISTENING 3972
>
> TCP127.0.0.1:55618127.0.0.1:55619
> ESTABLISHED 3972
>
> TCP127.0.0.1:55619127.0.0.1:55618
> ESTABLISHED 3972
>
> TCP127.0.0.1:55620127.0.0.1:55621
> ESTABLISHED 3972
>
> TCP127.0.0.1:55621127.0.0.1:55620
> ESTABLISHED 3972
>
> TCP[::]:8080  [::]:0
> LISTENING 3972
>
> These can grow to a large number (several thousand) on a
> busy system. What are these connections used for? What caused
> them? What thread are they attributed to?

 The Java NIO implementation on Windows uses TCP for
 intra-process signalling. It opens a pair of self-connected
 sockets for every Selector.

 Mark

>>>
>>> While we're at it, under Linux, are the following for a similar
>>> reason ?
>>>
>>> output of :  netstat -pan | grep 27514   (tomcat's JVM PID =
>>> 27514) [...] unix  2  [ ] STREAM CONNECTED
>>> 167427210 27514/java unix  2  [ ] STREAM
>>> CONNECTED 167423436 27514/java
>>>
>>>
>>>
>>> -
>>>
>>>
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>
>>
>> -
>>
>>
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> -BEGIN PGP SIGNATURE-
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl6DUP8ACgkQHPApP6U8
> pFgxiBAAkmLWWhwvrLW+RJ5j3ZKEu5cXQ0x3/zsMpFuP2GPok1lemXixa8T91lSO
> eGg6W80DhVb76tDJl4Akt3L8ejN2XNgSxnHgGfEiCvTughYryAmHNXxze3ZMj4BQ
> pvIO8hCc1nSlti71h6C2vEGYLnwkHyMulIolYaHP+SxKX7PSxXcfo4zD6vvpTvnO
> U5Hrk7H8JjXCANrd8LsChN8w8AkWMUJpu/TUXFYy8bWEN9Ui7SdGqfa1t+pwnl8+
> JZqO1moBP9WcMA/XR1msWIbkA8B1r+ICWqlqcdGlvkXrHzkiALdqpxy0WiKAs1Tn
> J+uPp0mAGpXRU3NGibr5NMtHLQ3Kl+X821yHYjF0XjqFwjLgvQNrmdYwblqFCUPB
> 9sIVr6CuWAxPM61QZ9Bi9fT4MrIA6f8iSEa7BDJmUWhARPQMKn6fjIOMd8Cok882
> cGU1WT8O2SrtQV+y7wJbbq4aP4e6vRi/nSqI2hlSFdTBfD1Grj+t5JPHg35AafR4
> +6qum9rVF3AKf47UoJFrXG9smWLkUVVsJuZbdHLofmQEV0ovOMzAPx2GR9oSR2/M
> sCxdUdqrhEW08wwYwIOV59vNa9pn/X/SOEre09yLH/GMV3H03CiQni616luWPrQt
> 0BzFi4+8TPVzKCaq88ThyjJnEMuDU9RNeS7IHScHTXQa6rflB7E=
> =q/Fd
> -END PGP SIGNATURE-
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread tomcat/perl

On 31.03.2020 15:30, Mark Thomas wrote:

On 31/03/2020 13:29, André Warnier (tomcat/perl) wrote:

On 31.03.2020 14:20, Mark Thomas wrote:

On 31/03/2020 11:20, Aditya Kumar wrote:

Tomcat 9.0.30 on Windows Server 2012 / Java 1.8

I've noticed on a freshly installed version of tomcat 9, upon startup
there
are several connections to and from localhost on different ports

For example on my tomcat server there are 4 connections to and from
localhost (output from netstat)

   TCP    0.0.0.0:8080   0.0.0.0:0
LISTENING   3972
   TCP    127.0.0.1:55618    127.0.0.1:55619
ESTABLISHED 3972
   TCP    127.0.0.1:55619    127.0.0.1:55618
ESTABLISHED 3972
   TCP    127.0.0.1:55620    127.0.0.1:55621
ESTABLISHED 3972
   TCP    127.0.0.1:55621    127.0.0.1:55620
ESTABLISHED 3972
   TCP    [::]:8080  [::]:0
LISTENING   3972

These can grow to a large number (several thousand) on a busy system.
What
are these connections used for? What caused them? What thread are they
attributed to?


The Java NIO implementation on Windows uses TCP for intra-process
signalling. It opens a pair of self-connected sockets for every Selector.

Mark



While we're at it, under Linux, are the following for a similar reason ?

output of :  netstat -pan | grep 27514   (tomcat's JVM PID = 27514)
[...]
unix  2  [ ] STREAM CONNECTED 167427210 27514/java
unix  2  [ ] STREAM CONNECTED 167423436 27514/java


Don't know. One possible way to check would be to add an additional NIO
connector and see if you get more of them.



Note : this is not very important, was just curiosity

But Nope.

I added a second HTTP Connector (port 8180), which by default should be NIO :





and restarted tomcat, but the number of listed unix sockets remains the same :

root@xxx:~# netstat -pan | grep 32647  (tomcat 8.5 has a new PID)
tcp6   0  0 127.0.0.1:8005  :::*LISTEN  
32647/java
tcp6   0  0 127.0.0.1:8009  :::*LISTEN  
32647/java
tcp6   0  0 :::8080 :::*LISTEN  
32647/java
tcp6   0  0 127.0.0.1:8180  :::*LISTEN  
32647/java
tcp6   0  0 127.0.0.1:8009  127.0.0.1:45190 ESTABLISHED 
32647/java
unix  2  [ ] STREAM CONNECTED 190838270 32647/java
unix  2  [ ] STREAM CONNECTED 190846897 32647/java
root@darwin:~#


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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Frank,

On 3/31/20 09:30, Frank Tornack wrote:
> Yes, these too are for communication between processes. Only you
> don't use the network stack. This is a special feature of Unix-like
> operating systems.
>
> DGRAM, unlike STREAM, does not know connection states. Therefore
> STREAM is comparable to a local TCP connection. Unix domain sockets
> exist in the file tree as special files. Access is controlled by
> file permissions, as is usual for files.

Yup. It's helpful to see the column headers for your netstat output,
André:

> Proto RefCnt Flags   Type   State I-Node
> PID/Program name Path unix  2  [ ] STREAM
> CONNECTED 167427210 27514/java unix  2  [ ] STREAM
> CONNECTED 167423436 27514/java

Each "unix" protocol-connection (UNIX domain socket) has an associated
inode on the root filesystem, but no path. Basically, it's magic. :)

The nice thing on *NIX is that even though there is a hand-wavy device
supporting NIO for Java, it doesn't consume pairs of ports (which are
a limited resource; see our recent discussion on the limits of TCP
port numbers).

- -chris

> Am Dienstag, den 31.03.2020, 14:29 +0200 schrieb André Warnier
> (tomcat/perl):
>> On 31.03.2020 14:20, Mark Thomas wrote:
>>> On 31/03/2020 11:20, Aditya Kumar wrote:
 Tomcat 9.0.30 on Windows Server 2012 / Java 1.8

 I've noticed on a freshly installed version of tomcat 9,
 upon startup there are several connections to and from
 localhost on different ports

 For example on my tomcat server there are 4 connections to
 and from localhost (output from netstat)


 TCP0.0.0.0:8080   0.0.0.0:0
 LISTENING 3972

 TCP127.0.0.1:55618127.0.0.1:55619
 ESTABLISHED 3972

 TCP127.0.0.1:55619127.0.0.1:55618
 ESTABLISHED 3972

 TCP127.0.0.1:55620127.0.0.1:55621
 ESTABLISHED 3972

 TCP127.0.0.1:55621127.0.0.1:55620
 ESTABLISHED 3972

 TCP[::]:8080  [::]:0
 LISTENING 3972

 These can grow to a large number (several thousand) on a
 busy system. What are these connections used for? What caused
 them? What thread are they attributed to?
>>>
>>> The Java NIO implementation on Windows uses TCP for
>>> intra-process signalling. It opens a pair of self-connected
>>> sockets for every Selector.
>>>
>>> Mark
>>>
>>
>> While we're at it, under Linux, are the following for a similar
>> reason ?
>>
>> output of :  netstat -pan | grep 27514   (tomcat's JVM PID =
>> 27514) [...] unix  2  [ ] STREAM CONNECTED
>> 167427210 27514/java unix  2  [ ] STREAM
>> CONNECTED 167423436 27514/java
>>
>>
>>
>> -
>>
>>
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>
>
> -
>
>
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl6DUP8ACgkQHPApP6U8
pFgxiBAAkmLWWhwvrLW+RJ5j3ZKEu5cXQ0x3/zsMpFuP2GPok1lemXixa8T91lSO
eGg6W80DhVb76tDJl4Akt3L8ejN2XNgSxnHgGfEiCvTughYryAmHNXxze3ZMj4BQ
pvIO8hCc1nSlti71h6C2vEGYLnwkHyMulIolYaHP+SxKX7PSxXcfo4zD6vvpTvnO
U5Hrk7H8JjXCANrd8LsChN8w8AkWMUJpu/TUXFYy8bWEN9Ui7SdGqfa1t+pwnl8+
JZqO1moBP9WcMA/XR1msWIbkA8B1r+ICWqlqcdGlvkXrHzkiALdqpxy0WiKAs1Tn
J+uPp0mAGpXRU3NGibr5NMtHLQ3Kl+X821yHYjF0XjqFwjLgvQNrmdYwblqFCUPB
9sIVr6CuWAxPM61QZ9Bi9fT4MrIA6f8iSEa7BDJmUWhARPQMKn6fjIOMd8Cok882
cGU1WT8O2SrtQV+y7wJbbq4aP4e6vRi/nSqI2hlSFdTBfD1Grj+t5JPHg35AafR4
+6qum9rVF3AKf47UoJFrXG9smWLkUVVsJuZbdHLofmQEV0ovOMzAPx2GR9oSR2/M
sCxdUdqrhEW08wwYwIOV59vNa9pn/X/SOEre09yLH/GMV3H03CiQni616luWPrQt
0BzFi4+8TPVzKCaq88ThyjJnEMuDU9RNeS7IHScHTXQa6rflB7E=
=q/Fd
-END PGP SIGNATURE-

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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Mark Thomas
On 31/03/2020 13:49, Aditya Kumar wrote:
> Hi Mark,
> 
> Sorry I'm not familiar with what a Selector is? However on one system I've
> noticed 28000 such connections. Are these caused by client connections? I'm
> not saying the connection originates from a client, but does the type of
> socket get create because of client connections?

A selector is what a NIO Connector uses to "select" the socket
connections that have data waiting to be processed out of all of the
current connections. I'd expect a 1:1 mapping between Selectors and
Tomcat Connectors. (It might be 2:1 to n+1:n I'd need to look at the
code to be sure but it will be driven by listening sockets on Tomcat,
not client connections.

It looks like something is creating selectors but not destroying them.
That might be Tomcat code but at those numbers I think the application
is more likely.

I recommend using a profiler to track the current number of Selectors
and trying to work out what triggers the creation of a new one.

Mark


> 
> On Tue, Mar 31, 2020 at 1:20 PM Mark Thomas  wrote:
> 
>> On 31/03/2020 11:20, Aditya Kumar wrote:
>>> Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
>>>
>>> I've noticed on a freshly installed version of tomcat 9, upon startup
>> there
>>> are several connections to and from localhost on different ports
>>>
>>> For example on my tomcat server there are 4 connections to and from
>>> localhost (output from netstat)
>>>
>>>  TCP0.0.0.0:8080   0.0.0.0:0  LISTENING
>>  3972
>>>  TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED
>>  3972
>>>  TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED
>>  3972
>>>  TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED
>>  3972
>>>  TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED
>>  3972
>>>  TCP[::]:8080  [::]:0 LISTENING
>>  3972
>>>
>>> These can grow to a large number (several thousand) on a busy system.
>> What
>>> are these connections used for? What caused them? What thread are they
>>> attributed to?
>>
>> The Java NIO implementation on Windows uses TCP for intra-process
>> signalling. It opens a pair of self-connected sockets for every Selector.
>>
>> Mark
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
> 


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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Frank Tornack
Yes, these too are for communication between processes. Only you don't
use the network stack. This is a special feature of Unix-like operating
systems.

DGRAM, unlike STREAM, does not know connection states. Therefore STREAM
is comparable to a local TCP connection. Unix domain sockets exist in
the file tree as special files. Access is controlled by file
permissions, as is usual for files. 

Am Dienstag, den 31.03.2020, 14:29 +0200 schrieb André Warnier
(tomcat/perl):
> On 31.03.2020 14:20, Mark Thomas wrote:
> > On 31/03/2020 11:20, Aditya Kumar wrote:
> > > Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
> > > 
> > > I've noticed on a freshly installed version of tomcat 9, upon
> > > startup there
> > > are several connections to and from localhost on different ports
> > > 
> > > For example on my tomcat server there are 4 connections to and
> > > from
> > > localhost (output from netstat)
> > > 
> > >  
> > > TCP0.0.0.0:8080   0.0.0.0:0  LISTENING   
> > > 3972
> > >  
> > > TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED 
> > > 3972
> > >  
> > > TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED 
> > > 3972
> > >  
> > > TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED 
> > > 3972
> > >  
> > > TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED 
> > > 3972
> > >  
> > > TCP[::]:8080  [::]:0 LISTENING   
> > > 3972
> > > 
> > > These can grow to a large number (several thousand) on a busy
> > > system. What
> > > are these connections used for? What caused them? What thread are
> > > they
> > > attributed to?
> > 
> > The Java NIO implementation on Windows uses TCP for intra-process
> > signalling. It opens a pair of self-connected sockets for every
> > Selector.
> > 
> > Mark
> > 
> 
> While we're at it, under Linux, are the following for a similar
> reason ?
> 
> output of :  netstat -pan | grep 27514   (tomcat's JVM PID = 27514)
> [...]
> unix  2  [ ] STREAM CONNECTED 167427210
> 27514/java
> unix  2  [ ] STREAM CONNECTED 167423436
> 27514/java
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Mark Thomas
On 31/03/2020 13:29, André Warnier (tomcat/perl) wrote:
> On 31.03.2020 14:20, Mark Thomas wrote:
>> On 31/03/2020 11:20, Aditya Kumar wrote:
>>> Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
>>>
>>> I've noticed on a freshly installed version of tomcat 9, upon startup
>>> there
>>> are several connections to and from localhost on different ports
>>>
>>> For example on my tomcat server there are 4 connections to and from
>>> localhost (output from netstat)
>>>
>>>   TCP    0.0.0.0:8080   0.0.0.0:0 
>>> LISTENING   3972
>>>   TCP    127.0.0.1:55618    127.0.0.1:55619   
>>> ESTABLISHED 3972
>>>   TCP    127.0.0.1:55619    127.0.0.1:55618   
>>> ESTABLISHED 3972
>>>   TCP    127.0.0.1:55620    127.0.0.1:55621   
>>> ESTABLISHED 3972
>>>   TCP    127.0.0.1:55621    127.0.0.1:55620   
>>> ESTABLISHED 3972
>>>   TCP    [::]:8080  [::]:0
>>> LISTENING   3972
>>>
>>> These can grow to a large number (several thousand) on a busy system.
>>> What
>>> are these connections used for? What caused them? What thread are they
>>> attributed to?
>>
>> The Java NIO implementation on Windows uses TCP for intra-process
>> signalling. It opens a pair of self-connected sockets for every Selector.
>>
>> Mark
>>
> 
> While we're at it, under Linux, are the following for a similar reason ?
> 
> output of :  netstat -pan | grep 27514   (tomcat's JVM PID = 27514)
> [...]
> unix  2  [ ] STREAM CONNECTED 167427210 27514/java
> unix  2  [ ] STREAM CONNECTED 167423436 27514/java

Don't know. One possible way to check would be to add an additional NIO
connector and see if you get more of them.

Mark

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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Aditya Kumar
Hi Mark,

Sorry I'm not familiar with what a Selector is? However on one system I've
noticed 28000 such connections. Are these caused by client connections? I'm
not saying the connection originates from a client, but does the type of
socket get create because of client connections?

On Tue, Mar 31, 2020 at 1:20 PM Mark Thomas  wrote:

> On 31/03/2020 11:20, Aditya Kumar wrote:
> > Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
> >
> > I've noticed on a freshly installed version of tomcat 9, upon startup
> there
> > are several connections to and from localhost on different ports
> >
> > For example on my tomcat server there are 4 connections to and from
> > localhost (output from netstat)
> >
> >  TCP0.0.0.0:8080   0.0.0.0:0  LISTENING
>  3972
> >  TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED
>  3972
> >  TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED
>  3972
> >  TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED
>  3972
> >  TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED
>  3972
> >  TCP[::]:8080  [::]:0 LISTENING
>  3972
> >
> > These can grow to a large number (several thousand) on a busy system.
> What
> > are these connections used for? What caused them? What thread are they
> > attributed to?
>
> The Java NIO implementation on Windows uses TCP for intra-process
> signalling. It opens a pair of self-connected sockets for every Selector.
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread tomcat/perl

On 31.03.2020 14:20, Mark Thomas wrote:

On 31/03/2020 11:20, Aditya Kumar wrote:

Tomcat 9.0.30 on Windows Server 2012 / Java 1.8

I've noticed on a freshly installed version of tomcat 9, upon startup there
are several connections to and from localhost on different ports

For example on my tomcat server there are 4 connections to and from
localhost (output from netstat)

  TCP0.0.0.0:8080   0.0.0.0:0  LISTENING   3972
  TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED 3972
  TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED 3972
  TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED 3972
  TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED 3972
  TCP[::]:8080  [::]:0 LISTENING   3972

These can grow to a large number (several thousand) on a busy system. What
are these connections used for? What caused them? What thread are they
attributed to?


The Java NIO implementation on Windows uses TCP for intra-process
signalling. It opens a pair of self-connected sockets for every Selector.

Mark



While we're at it, under Linux, are the following for a similar reason ?

output of :  netstat -pan | grep 27514   (tomcat's JVM PID = 27514)
[...]
unix  2  [ ] STREAM CONNECTED 167427210 27514/java
unix  2  [ ] STREAM CONNECTED 167423436 27514/java



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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Mark Thomas
On 31/03/2020 11:20, Aditya Kumar wrote:
> Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
> 
> I've noticed on a freshly installed version of tomcat 9, upon startup there
> are several connections to and from localhost on different ports
> 
> For example on my tomcat server there are 4 connections to and from
> localhost (output from netstat)
> 
>  TCP0.0.0.0:8080   0.0.0.0:0  LISTENING   3972
>  TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED 3972
>  TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED 3972
>  TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED 3972
>  TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED 3972
>  TCP[::]:8080  [::]:0 LISTENING   3972
> 
> These can grow to a large number (several thousand) on a busy system. What
> are these connections used for? What caused them? What thread are they
> attributed to?

The Java NIO implementation on Windows uses TCP for intra-process
signalling. It opens a pair of self-connected sockets for every Selector.

Mark

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



Re: Why does Tomcat open connections on localhost?

2020-03-31 Thread Frank Tornack
Hi Aditya,

I'm not quite sure, but it could be a replacement for the sockets that
a Linux system provides for inter-process communication.

But it's just a guess, because I don't see this behavior on Linux.

kindly
Frank

Am Dienstag, den 31.03.2020, 11:20 +0100 schrieb Aditya Kumar:
> Tomcat 9.0.30 on Windows Server 2012 / Java 1.8
> 
> I've noticed on a freshly installed version of tomcat 9, upon startup
> there
> are several connections to and from localhost on different ports
> 
> For example on my tomcat server there are 4 connections to and from
> localhost (output from netstat)
> 
>  TCP0.0.0.0:8080   0.0.0.0:0  LISTENING  
>  3972
>  TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED
>  3972
>  TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED
>  3972
>  TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED
>  3972
>  TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED
>  3972
>  TCP[::]:8080  [::]:0 LISTENING  
>  3972
> 
> These can grow to a large number (several thousand) on a busy system.
> What
> are these connections used for? What caused them? What thread are
> they
> attributed to?


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



Why does Tomcat open connections on localhost?

2020-03-31 Thread Aditya Kumar
Tomcat 9.0.30 on Windows Server 2012 / Java 1.8

I've noticed on a freshly installed version of tomcat 9, upon startup there
are several connections to and from localhost on different ports

For example on my tomcat server there are 4 connections to and from
localhost (output from netstat)

 TCP0.0.0.0:8080   0.0.0.0:0  LISTENING   3972
 TCP127.0.0.1:55618127.0.0.1:55619ESTABLISHED 3972
 TCP127.0.0.1:55619127.0.0.1:55618ESTABLISHED 3972
 TCP127.0.0.1:55620127.0.0.1:55621ESTABLISHED 3972
 TCP127.0.0.1:55621127.0.0.1:55620ESTABLISHED 3972
 TCP[::]:8080  [::]:0 LISTENING   3972

These can grow to a large number (several thousand) on a busy system. What
are these connections used for? What caused them? What thread are they
attributed to?