[Xubuntu] Message "Connected to myself" logged every minute on daemon log

This message is logged every minute on the daemon log:

It doesn’t seem to impact anything because syncthing is running smoothly.

I had only syncthing installed and running, and this message was not being logged. But yesterday I decided to wipe out completely my syncthing configuration, install syncthing-gtk, and reconfigure everything from scratch. Since then, that message is being logged every minute on the daemon log.

I don’t know what to do to stop the daemon from doing whatever is doing that causes this message.

These are the versions I’m running:

syncthing 0.10.30 syncthing-gtk 0.6.4 xubuntu 14.10

You have some port-forwarding/proxy issues. Or you have the same device ID on both sides (because you copied the certificates across)

Thanks for the reply, @AudriusButkevicius !

These are the devices I have currently defined, with their IDs:


I have only one port forwarded in my router:

These are the ports opened on my firewall:

I’m not using proxies. I don’t know what could be wrong.

EDIT: Would a trace be useful to debug this ? I’m not sure which facility to trace in order to corner the problem more precisely.

I think I have an inkling about what’s happening but I don’t know how to solve it. I started syncthing with trace enabled:

STTRACE=net syncthing

and I think this excerpt from the logged messages shows light on the problem:

[2L7Y5] 2015/04/10 13:46:52.015337 connections.go:222: DEBUG: dial ZR2LWNP-5DLSR4Q-33QNK5F-4GJ7VPQ-2JI6DHO-XG74SA3-6VHBF2F-RAMY5AB
[2L7Y5] 2015/04/10 13:46:52.018223 connections.go:165: DEBUG: connect from
[2L7Y5] 2015/04/10 13:46:52.159063 connections.go:61: INFO: Connected to myself (2L7Y5KS-FT54OO7-36LTKTR-FLMQPVE-BNF6TQS-CZ2Q7SK-DVULE6U-ELWBIAC) - should not happen

ZR2LWNP-5DLSR4Q-33QNK5F-4GJ7VPQ-2JI6DHO-XG74SA3-6VHBF2F-RAMY5AB is my cell phone, device thelonious, trying to connect to my laptop, id 2L7Y5KS-FT54OO7-36LTKTR-FLMQPVE-BNF6TQS-CZ2Q7SK-DVULE6U-ELWBIAC. As both laptop and cell phone are currently behind the same router, they’ll both have the same external ip address, so syncthing interprets that my laptop is trying to connect to itself.

But then shouldn’t syncthing check the source and destination IDs ? In this case, even though the ip address is the same, the IDs are different.

Should I open an issue for this ?

Did you enable local discovery one both devices?

Hey @wweich, I was just about to edit my previous post to say that I have both local and global discovery enabled on both devices, when I saw your post.

EDIT: On my laptop:

On my cell phone (screenshot synced thanks to syncthing ! :smile:):

Do you have non-dynamic IPs configured? Because that could be the cause. Also, if you are relying on external discovery, you should move protocol ports to be different on the phone and the device, because even though you are forwarding :22000::<NOT 22000>, the discovery announcement goes out as :22000 (because we don’t know the port we got mapped), causing you to connect to yourself.

Hence make sure that the internal and external ports are the same, but just use different ports if you have multiple devices going through the same firewall/router.

Oh, I see … it makes sense, let me see if I understood it:

  1. Both my cell phone and laptop are announcing that they can be found on port 22000
  2. As both devices are behind the same router, they get the same external ip address
  3. My router is forwarding port 22000 to my laptop’s ip address
  4. The connection requests sent from my laptop to my cell phone are warping back to the laptop because my router forwards all traffic to port 220000 to my laptop

Just confirming:

  1. If I switched off global discovery on my cell phone, I wouldn’t have this problem, but then I’d only be able to sync with my laptop when they were both connected to the same router
  2. If I maintain global discovery on my cell phone, I’ll necessarily have to make it listen on a different port, but then I’d also have to configure the router’s DHCP to send it a fixed ip address, and forward its port

Are these assumptions correct ?

What would you recommend as an optimal port/discovery configuration for a scenario such as mine, with one single laptop and one single cell phone ?

EDIT: A very basic doubt: If I switch off global discovery on both devices, then I don’t even need to forward any ports on the router, right ?

Devices prefer finding each other over local discovery (subject they are in the same subnet). If they cannot do that, then they prefer global discovery. In case UPnP is available, UPnP tells us what’s out external port and we advertise that. Given UPnP is not available, we advertise the port we are listening on. Now because both devices listen on the same port, they probably announce the same thing, hence looking up A returns B’s address and B connects to itself. Change the protocol port on the phone to 22001 and forward :22001 to :22001 (even if its by mac address rather than IP address) and it should work fine.

1 Like

Thanks for the explanation, @AudriusButkevicius, and all your previous input.