Bug 376187 - kdeconnect.core: Error opening a port in range 1714-1764 when http_proxy environment variable is set
Summary: kdeconnect.core: Error opening a port in range 1714-1764 when http_proxy envi...
Status: RESOLVED FIXED
Alias: None
Product: kdeconnect
Classification: Applications
Component: common (show other bugs)
Version: 1.0
Platform: Arch Linux Linux
: NOR major
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-08 15:08 UTC by bugzilla-kde
Modified: 2017-03-06 21:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugzilla-kde 2017-02-08 15:08:02 UTC
Since some time, my Arch Linux desktop isn't visible to my mobile devices any more. AFAICT the culprit is kdeconnectd not being able to open network ports:

[~]$ journalctl -b _COMM=kdeconnectd            
-- Logs begin at Sun 2017-01-22 20:26:10 CET, end at Wed 2017-02-08 15:43:09 CET. --
Feb 08 12:46:11 archdesktop kdeconnectd[1120]: kdeconnect.core: KdeConnect daemon starting
Feb 08 12:46:11 archdesktop kdeconnectd[1120]: kdeconnect.core: onStart
Feb 08 12:46:11 archdesktop kdeconnectd[1120]: kdeconnect.core: Error opening a port in range 1714-1764
Feb 08 12:46:11 archdesktop kdeconnectd[1120]: kdeconnect.core: KdeConnect daemon started
Feb 08 12:46:36 archdesktop kdeconnectd[1120]: kdeconnect.core: Sending onNetworkChange to  1  LinkProviders

But:

[~]$ sudo netstat -tulpn | grep :17            
[~]$ sudo netstat -tupn | grep :17            
[~]$ nc -l 1714                                        
^C
[~]$ killall kdeconnectd; /usr/lib/kdeconnectd            
kdeconnect.core: KdeConnect daemon starting
kdeconnect.core: onStart
kdeconnect.core: Error opening a port in range 1714-1764
kdeconnect.core: KdeConnect daemon started
^C                                              
[~]$

Since netstat doesn't show any port in the range 1714-1764 in use and nc can bind to ports in this range without problems, I have no idea why kdeconnectd fails to do so.
kdeconnect has worked well on this machine. But since I don't use kdeconnect everyday I can't tell when exactly it has stopped working or what change on the machine may have caused it to stop.

What can I do to find out what the problem is and (hopefully) fix it?

The machine in question is a up-to-date 64-bit Arch Linux running plasma.
Comment 1 bugzilla-kde 2017-03-06 17:56:54 UTC
AFAICT kdeconnectd doesn't work when the http_proxy environment variable is set:

[~]$ killall kdeconnectd
[~]$ export http_proxy=http://localhost:3128/
[~]$ /usr/lib/kdeconnectd 
kdeconnect.core: KdeConnect daemon starting
kdeconnect.core: onStart
kdeconnect.core: Error opening a port in range 1714-1764
kdeconnect.core: KdeConnect daemon started
^C
[~]$ unset http_proxy 
[~]$ /usr/lib/kdeconnectd 
kdeconnect.core: KdeConnect daemon starting
kdeconnect.core: onStart
kdeconnect.core: KdeConnect daemon started
kdeconnect.core: Broadcasting identity packet
^C
[~]$

I don't know if that is to be expected or if it is a bug in QTcpServer. If the former is true, it might be a good idea to remove http_proxy from the environment on program start.
Comment 2 Albert Vaca Cintora 2017-03-06 21:02:12 UTC
Git commit a4f2a60d47e615c4bd03c85e8e8b9bf5647a01f2 by Albert Vaca.
Committed on 06/03/2017 at 21:02.
Pushed by albertvaka into branch '1.x'.

Do not use the default proxy.

Qt uses the system proxy if set up, explicitly disable it.

M  +8    -0    core/backends/lan/lanlinkprovider.cpp

https://commits.kde.org/kdeconnect-kde/a4f2a60d47e615c4bd03c85e8e8b9bf5647a01f2