rootkiwi / an2linuxserver

Sync Android notifications encrypted to a Linux desktop
Other
401 stars 43 forks source link

Errors reported about 'binding' #47

Closed LinuxOnTheDesktop closed 4 years ago

LinuxOnTheDesktop commented 4 years ago

~/.xsession-errors contains:

UdevQt: unhandled device action "unbind"
Traceback (most recent call last):
  File "/home/nicholas/an2linux/code/an2linuxserver.py", line 826, in <module>
    tcp_server = ThreadingDualStackServer(('', tcp_port_number), TCPHandler)
  File "/usr/lib/python3.6/socketserver.py", line 456, in __init__
    self.server_bind()
  File "/home/nicholas/an2linux/code/an2linuxserver.py", line 272, in server_bind
    super().server_bind()
  File "/usr/lib/python3.6/socketserver.py", line 470, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use

Still the last time I tested it the software does work.

I am running the software via systemd as a 'user' service.

OS: Linux Mint 19.1 Tessa x86_64 Host: 20KHCTO1WW ThinkPad X1 Carbon 6th Kernel: 5.1.16-050116-generic Uptime: 2 days, 16 hours, 40 mins Packages: 3199 (dpkg), 3 (snap) Shell: bash 4.4.20 Resolution: 2560x1440 @ 60.01Hz DE: Cinnamon 4.2.0 WM: Mutter (Muffin)

I have the latest git version of an2linux.

rootkiwi commented 4 years ago

Have you tried with a different port number?

LinuxOnTheDesktop commented 4 years ago

No, but I can do. Yet, how am to understand the error message? Should I infer that some other program is using the port? That some other instance of an2linux is using the port? Something else?

rootkiwi commented 4 years ago

To get information about what program is using the port try running something like:

ss --tcp --listening --processes | grep 48215

Which will output something like:

LISTEN   0        5                      *:48215                       *:*       users:(("python3",pid=812,fd=3))
LinuxOnTheDesktop commented 4 years ago

So, the error message means that some other process is using An2Linux's port? OK. But . .

ss --tcp --listening --processes | grep 46352 LISTEN 0 5 :46352 :* users:(("python3",pid=28892,fd=5))

So, the only process using the port seems to be (a single instance of) an2linux itself. Please advise.

rootkiwi commented 4 years ago

Yeah it seems that an2linux is running? Strange.

How do you run an2linux? Do you use a systemd service or something?

If you run

ps aux | grep an2linux

and

ps aux | grep python

Do you see something about an2linuxserver.py running?

LinuxOnTheDesktop commented 4 years ago

Thanks.

As I said

I am running the software via systemd as a 'user' service.

$  ps aux | grep an2linux
nicholas 10734  0.0  0.0  14428  1116 pts/0    S+   16:54   0:00 grep --color=auto an2linux
nicholas 18490  1.7  2.8 3407660 459136 ?      S<l  16:16   0:39 /usr/lib/firefox/firefox https://github.com/rootkiwi/an2linuxserver/issues/47?email_source=notifications&email_token=ALHANH33DR3XBADLPVMGNS3QARR4TA5CNFSM4IFCAGOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2OD3CI#issuecomment-513555849
nicholas 28892  0.0  0.1 312172 20824 ?        Ssl  16:27   0:00 python3 /home/nicholas/services/an2linux/an2linuxserver.py
$  ps aux | grep python
root      1610  0.0  0.1 211016 20156 ?        Ssl  Jul19   0:22 /opt/lenovo_fix/venv/bin/python3 /opt/lenovo_fix/lenovo_fix.py
root      1647  0.4  0.0 191220 13700 ?        SNsl Jul19  15:04 python3 /usr/bin/ananicy start
nicholas  4542  0.0  0.5 1267116 86504 ?       Sl   Jul19   0:47 /usr/bin/python3 /usr/bin/ulauncher --hide-window
nicholas  4591  0.0  0.2 370756 47644 ?        Sl   Jul19   0:00 /usr/bin/python3 /home/nicholas/.cache/ulauncher_cache/extensions/com.github.dalanicolai.gnome-tracker-extension/main.py
nicholas  4593  0.0  0.2 365128 41200 ?        Sl   Jul19   0:00 /usr/bin/python3 /home/nicholas/.cache/ulauncher_cache/extensions/com.github.psukys.ulauncher-plugin-windows/main.py
nicholas  4694  0.0  0.0  30824 10472 ?        S    Jul19   0:00 python3 /usr/lib/blueberry/safechild /usr/sbin/rfkill event
nicholas  6346  0.0  0.2 266820 40072 ?        Sl   Jul19   0:01 /usr/bin/python3 /usr/share/system-config-printer/applet.py
nicholas 26219  0.0  0.0  14428  1012 pts/0    S+   16:58   0:00 grep --color=auto python
nicholas 28892  0.0  0.1 312172 20824 ?        Ssl  16:27   0:00 python3 /home/nicholas/services/an2linux/an2linuxserver.py
nicholas 31751  0.0  0.5 854748 94300 ?        Sl   16:44   0:00 /usr/bin/python3 /usr/bin/angrysearch

I am having trouble determining what is doing that grep.

rootkiwi commented 4 years ago

As I said

I am running the software via systemd as a 'user' service.

Right, sorry.

Okey so it seems that an2linux is running. But it does not work at all? What happens if you restart the service.

Don't know why the service or whatever have run an2linux multiple times

LinuxOnTheDesktop commented 4 years ago

Okey so it seems that an2linux is running. But it does not work at all? What happens if you restart the service.

It does indeed seem not to be working (though it used to work). I have Wireguard on the phone (and on the Linux PC) but turning Wireguard off did not make any difference (turning it off on the phone, I mean; I've long had it on the PC, including the time with an2Linux worked).

The service restarts without error but after the restart I continue to see no notifications.

LinuxOnTheDesktop commented 4 years ago

Ah, but, actually: the notifications are working, at least sometimes (after the restart?) and for new notifications. I'm doing more testing . .

rootkiwi commented 4 years ago

I have Wireguard on the phone (and on the Linux PC) but turning Wireguard off did not make any difference (turning it off on the phone, I mean; I've long had it on the PC, including the time with an2Linux worked).

Yeah so do I (both PC and phone).

If you use a LAN ip make sure to check Exclude private IPs on the wireguard android app to not route over VPN for local connections.

Strange that it works sometimes and sometimes not. Not sure what the problem is. Report back if you find something

LinuxOnTheDesktop commented 4 years ago

If I restart an2linux, then, when I generate a new notification of the phone, the notification shows on the Linux computer; but it seems that no new notification will appear on the computer until I restart an2linux once again. All this is with Android disabled on the phone. I'll look into that setting on the Android WG app that you mention - thanks!

If you use a LAN ip make sure to check Exclude private IPs on the wireguard android app to not route over VPN for local connections.

rootkiwi commented 4 years ago

That is strange

LinuxOnTheDesktop commented 4 years ago

Might the problem be with my Linux notification manager? Could we try to get an2linux to give sort of output when it receives a notification? Still, the error in the Linux syslog - which with I began this bugreport - suggests that error is not with the Linux notification manager.

LinuxOnTheDesktop commented 4 years ago

Consider:

Tentative inference: after showing a notification, or after a period of time, the program is trying to bind itself to a port (or something like that) a second time, when it should be so doing.

rootkiwi commented 4 years ago

Yeah output when notification should be added

LinuxOnTheDesktop commented 4 years ago

I have now tried with two different port numbers, namely 46352 and 46373 and - once I remembered to remove some troubleshooting kludge I had inserted - everything works.

rootkiwi commented 4 years ago

Great