Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I am using SymmetricDS to synchronise data between a server (Windows 10 machine) and client (Ubuntu Machine - Google Compute Engine) database. This requires me to set up a connection between the two systems.
I created a SSH tunnel using PuTTY on the Windows Machine to the Client and all of that is working fine.
Of course, when the connection closes uncleanly/unexpectedly, the SSH connection to the client machine terminates and needs to be restarted manually. I am therefore trying a fork of PuTTY, which is called KiTTY. Kitty has an option to automatically restart the SSH connection.
My aim is to have SymmetricDS resume synchronisation once the ssh connection has been restored by KiTTY.
The issue I am facing:
I start SymmetricDS on both machines and the ssh connection on the server. (Everything works perfectly). I then purposefully disconnect the ethernet cable. I then wait for 30 seconds or so and then restore the internet connection. KiTTY then automatically restarts the ssh connection. However, SymmetricDS does not resume synchronisation. It throws the following error client side:
DataLoaderService - Failed to process batch java.net.SocketTimeoutException: Read timed out
at java.base/java.net.SocketInputStream.socketRead0(Native Method)
at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
...etc
Before disconnecting the internet, I did a check of the ports that were being used:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1382/sshd
tcp 0 0 0.0.0.0:31415 0.0.0.0:* LISTEN 2110/java
tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 1972/sshd: gce_uname#p
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1364/mysqld
After the internet connection has been dropped and restored, I again did the same check:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1382/sshd
tcp 0 0 0.0.0.0:31415 0.0.0.0:* LISTEN 2110/java
tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 1972/sshd: gce_uname#p
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1364/mysqld
Which shows no change.
I then stop SymmetricDS and it free's port 31415 (which it uses):
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1382/sshd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1364/mysqld
When I start symmetricDS again, it starts listening on port 31415 again:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1382/sshd
tcp 0 0 0.0.0.0:31415 0.0.0.0:* LISTEN 2110/java
tcp 0 0 127.0.0.1:9090 0.0.0.0:* LISTEN 1972/sshd: gce_uname#p
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1364/mysqld
but again throws the error:
Could not communicate with omni:000:000 at http://localhost:9090/sync/omni-000 because: java.net.ConnectException: Connection refused (Connection refused)
I have tested this several times, but keeps throwing the same error.
Any ideas?
SymmetricDS is just like any other Java application that uses your network. Try testing the connection by visiting http://localhost:9090/sync/omni-000/ping in your web browser. If this problem reoccurs using other applications, then it is likely a problem with your network.
Related
If a webserver is handling traffic on port 80, each client must establish a connection between itself and the server on that port. Assuming a client maintains the connection, how is the server able to service other clients in parallel?
Does the server immediately kill the connection with a client after a request? Or do webservers dynamically generate new ports for clients to use such that port 80 is free for new connections?
A port is one end of a communication channel.
The server initials sets up a LISTENing port (80 in the case of an HTTPS server). A client creates a port (the operating system will assign a random, available port number to this) and CONNECTs to the listening port. At that point the communications channel is uniquely described by the IP address of the server, port 80 at the server, and the IP address of the client along with port number of the client. If you look at the output of netstat you'll see lots of sockets/ports in various stages of connection:
symcbean#skynet ~ $ netstat -t
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.1.202:47206 stackoverflow.com:https ESTABLISHED
tcp 0 1 192.168.1.202:50894 aba1c1ff9d2ec5376.:smtp SYN_SENT
tcp 0 0 192.168.1.202:47210 stackoverflow.com:https ESTABLISHED
tcp 0 0 192.168.1.202:60806 ec2-34-213-90-136:https ESTABLISHED
tcp 0 0 192.168.1.202:51124 151.101.1.69:https ESTABLISHED
tcp 0 0 192.168.1.202:34784 i0.wp.com:https ESTABLISHED
tcp 0 0 192.168.1.202:54082 lhr25s14-in-f10.1:https ESTABLISHED
tcp 0 0 192.168.1.202:38412 172-155-250-212.s:https ESTABLISHED
Exactly how the server handles communicating concurrently on multiple channels varies. I've never come across a server which only handles a single connection at a time.
On the (prefork) Apache webserver, the process which opened the listening socket hands off the connection to a pre-existing child process to deal with. Some servers run as a single process but with multiple threads of execution. Some (such as nginx and lighthttpd) run as a single thread and give their attention to the channel sending data first.
I used WAMP in the past without problem.
I needed to use skype for once, so I did and now the Apache service of WAMP won't start. When I test port 80 using the WAMP tools, I get this message:
***** Test which uses port 80 *****
===== Tested by command netstat filtered on port 80 =====
Test for TCP
Port 80 is not found associated with TCP protocol
Test for TCPv6
Port 80 is not found associated with TCP protocol
===== Tested by attempting to open a socket on port 80 =====
Your port 80 seems not actually used.
Unable to initiate a socket connection
Error number: 10061 -
I tried changing the port Skype uses, but this is not possible in the Windows 10 version. I installed Skype Classic and changed the port there, no result. Then changed Apache to port 8080, without result, so I changed it back to 80.
I fully uninstalled both Skype and Skype classic, then I uninstalled WAMP and installed it fresh again. Even after the removal of Skype and resinstallation of WAMP I still get the same error message.
I also tried to kill the tasks using port 80, but the only task I can actually kill is my firefox browser, result of netstat below.
C:\Windows\system32>netstat -aon | findstr :80
TCP 192.168.178.27:49893 93.184.220.29:80 ESTABLISHED 13120
TCP 192.168.178.27:49917 216.58.211.99:80 TIME_WAIT 0
TCP 192.168.178.27:49918 23.208.79.207:80 TIME_WAIT 0
TCP 192.168.178.27:49919 88.221.254.211:80 TIME_WAIT 0
TCP 192.168.178.27:49926 52.85.249.5:80 TIME_WAIT 0
TCP 192.168.178.27:49931 23.208.77.171:80 TIME_WAIT 0
TCP 192.168.178.27:49939 23.208.77.171:80 TIME_WAIT 0
TCP 192.168.178.27:49953 216.58.211.99:80 TIME_WAIT 0
TCP 192.168.178.27:49960 216.58.211.99:80 TIME_WAIT 0
Any help is appreciated.
I'm doing a GET request to my EC2 instance, but I'm getting the following error:
80: Connection refused
These are the security rules of my instance:
Ports Protocol Source launch-wizard-1
80 tcp 0.0.0.0/0 ✔
22 tcp 177.32.53.207/32 ✔
What's wrong with these rules? Why can't I access port 80?
EDIT
I attached my apache conf file (/etc/apache2/apache2.conf) in this url, since it's too big to post all the code here.
EDIT2
when I run netstat -ntlp | grep LISTEN
I get this:
(No info could be read for "-p": geteuid()=1000 but you should be root.)
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN -
tcp6 0 0 :::80 :::* LISTEN -
tcp6 0 0 :::22 :::* LISTEN
What is the source of your connection request? Are you attempting to access your instance from outside of Amazon or from a difference EC2 instance in the same availability zone? Are you supplying an IP address or a DNS name as the argument to your connecting code?
Keep in mind that AWS EC2 uses SDN (software defined networking) which doesn't work quite like classical TCP/IP routing that you may be expecting from using Linux, or other OSes, on bare metal systems (or even on VMs using more traditional networking).
Ultimately you will probably want to allocate "elastic IP" (EIP) from AWS and bind it to your web server instance. Then route your requests to that IP address. (Often you'd also create a DNS entry, perhaps through Amazon's "Route53" service to use the a name rather than the address).
It's possible to get to your instance from within and from outside their network. But you have to use the Amazon generated DNS name to do so then, because they use split-horizon, your clients will get the correct (internal or external) IP address.
Also you have to consider the security settings on your VPC (virtual private cloud) network(s) as well as those you've applied to your instance.
When I start Tomcat I see the following using netstat (filtered by tomcat PID):
TCP 0.0.0.0:5007 xxxx34793KZ:0 LISTENING
TCP 0.0.0.0:8081 xxxx34793KZ:0 LISTENING
TCP 0.0.0.0:8543 xxxx34793KZ:0 LISTENING
TCP 127.0.0.1:8005 xxxx34793KZ:0 LISTENING
TCP 127.0.0.1:29821 xxxx34793KZ:29822 ESTABLISHED
TCP 127.0.0.1:29822 xxxx34793KZ:29821 ESTABLISHED
TCP 127.0.0.1:29823 xxxx34793KZ:29824 ESTABLISHED
TCP 127.0.0.1:29824 xxxx34793KZ:29823 ESTABLISHED
TCP 127.0.0.1:29830 xxxx34793KZ:29831 ESTABLISHED
TCP 127.0.0.1:29831 xxxx34793KZ:29830 ESTABLISHED
TCP 127.0.0.1:29832 xxxx34793KZ:29833 ESTABLISHED
TCP 127.0.0.1:29833 xxxx34793KZ:29832 ESTABLISHED
TCP 127.0.0.1:29834 xxxx34793KZ:29835 ESTABLISHED
TCP 127.0.0.1:29835 xxxx34793KZ:29834 ESTABLISHED
TCP 127.0.0.1:29836 xxxx34793KZ:29837 ESTABLISHED
TCP 127.0.0.1:29837 xxxx34793KZ:29836 ESTABLISHED
TCP [::]:8081 xxxx34793KZ:0 LISTENING
TCP [::]:8543 xxxx34793KZ:0 LISTENING
Ports 29821-29824 and 29830-29837 are what I'm wondering about.
I have searched the web, tomcat documentation, tomcat source code and any mailing list I can think of (including Stackoverflow) and can find nothing on the purpose of these TCP ports. They come in pairs which implies to me that they are possibly configured to loopback. I'm stumped as to why Tomcat needs these.
Our application that runs on Tomcat gets installed into environments where IT Security is quite robust, so they want to know the reason for every port in use.
Any ideas?
I have chat application developed in vb.net . It is used to chat between PC's which are connected in LAN network inside a office. It uses TCP/IP port 25025 to connect to another. The app works fine . But in some cases receiver won't get the chat message.
So I just run the netstat -an command in that pc and find so many tcp ports and its state. Below is a part of it (error case). I have shown only lines which has 25025 in it.
Proto Local Address Foreign Address State
TCP 0.0.0.0:25025 0.0.0.0:0 LISTENING
TCP 192.168.1.79:25025 192.168.1.60:1320 TIME_WAIT
TCP 192.168.1.79:25025 192.168.1.60:1321 TIME_WAIT
TCP 192.168.1.79:58508 192.168.1.60:25025 TIME_WAIT
TCP 192.168.1.79:58509 192.168.1.60:25025 TIME_WAIT
TCP 192.168.1.79:58510 192.168.1.60:25025 TIME_WAIT
TCP 192.168.1.79:58511 192.168.1.60:25025 ESTABLISHED
Then i checked the same command where i didn't get any error with my app (proper working of my app). The output was,
TCP 192.168.1.60:25025 192.168.1.79:58511 ESTABLISHED
So how can i troubleshoot it? What does this so many port with 25025 indicate. In the error case i have lot of 25025 port as above shown. So please help me in understanding this and solve the problem.
Check to see whether the bind() call is succeeding or not. My guess is that when your application binds to the listening port it fails with the error "address already in use". The TIME_WAIT lines in the netstat output suggest this is so. But I'm guessing that your application isn't checking the return value from bind() and is blindly continuing assuming that the call succeeded. This would explain why it never receives anything.
You get "address already in use" if the socket has not completed its shutdown from an previous invocation of the application. Typically it takes about 4 minutes for the socket to be ready to be reused after it has been closed by the application, and in the meantime the state is TIME_WAIT.
You could use the SO_REUSEADDR socket option to avoid this TIME_WAIT period.