evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
9.87k stars 488 forks source link

1.6.0-rc5-1 Notification errors #906

Closed BetweenTheKeyboardAndChair closed 1 year ago

BetweenTheKeyboardAndChair commented 1 year ago

I'm seeing a number of errors in the shell where I started opensnitchd and the UI of the form:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/dbus/connection.py", line 232, in maybe_handle_message self._handler(*args, **kwargs) File "/usr/lib/python3/dist-packages/notify2.py", line 154, in _closed_callback n = notifications_registry[nid] KeyError: 160

The KeyError appears to increment. The rest is always the same.

It seems to trigger some of the time when I create a new rule in the UI as a response to something trying to open a connection. It is a small percentage of the time. I have not been able to find a pattern.

Include the following information: opensnitch/now 1.6.0-rc.5-1 amd64 python3-opensnitch-ui/now 1.6.0-rc.5-1 all OS: Ubuntu 20.04 WM: cinnamon-common/focal,focal,now 4.4.8-4 all Kernel: Linux ucin 5.4.0-137-generic #154-Ubuntu SMP Thu Jan 5 17:03:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

To Reproduce The errors seems to trigger some of the time when I create a new rule in the UI as a response to something trying to open a connection. It is a small percentage of the time. I have not been able to find a pattern.

Looking at the logs, all I see are entries for "Added new rule", and some "Saved new rule". There are no errors.

Possibly related: Some of the forever rules seem to get lost every few days. (IP related?)

Configuration: Database: In Memory Nodes: Proc method: proc (ebpf gives a warning on start on ubunutu 20.04) Rules: Don't save/Delete rules of duration is UNchecked Pop-ups: Filter connections also by Destination IP

Anything I can enable to get you better debugging info? (Explicit instructions please.)

gustavo-iniguez-goya commented 1 year ago

This error usually appears when a desktop notification is dismissed/clicked on.

See if clicking or dimissing a desktop notification generates that exception. In any case, it's not an opensnitch functionality error, but python3-notify2' package:

File "/usr/lib/python3/dist-packages/dbus/connection.py", line 232, in maybe_handle_message
File "/usr/lib/python3/dist-packages/notify2.py", line 154, in _closed_callback
BetweenTheKeyboardAndChair commented 1 year ago

Confirmed that it is caused by clicking dismiss notifications on the desktop.

gustavo-iniguez-goya commented 1 year ago

This was a bug in python3-notify2 package. Debian distributes version python3-notify2 0.3-5 which doesn't handle exceptions when closing notifications:

152 def _closed_callback(nid, reason):                                              
153     nid, reason = int(nid), int(reason)                                         
154     n = notifications_registry[nid]                                             
155     n._closed_callback(n)                                                       
156     del notifications_registry[nid]  

This was fixed on version 0.3.1: https://bitbucket.org/takluyver/pynotify2/commits/d4482e7169e3e9787d602d78f55c0cd74d805ff6