thsmi/sieve

Can't edit long Sieve script in WebApp after Python upgrade to 3.9.x

Opened this issue · 1 comments

Prerequisites

  • Tried the most recent nightly build
  • Checked if your issue is already reported.
  • Answered all the questions in this template (Or provide a working crystal ball).

What happened?

Recently we upgraded our server running the WebApp from Debian 10 to Debian 11. This meant that we moved from Python 3.7.3 to Python 3.9.2. We aren't using any virtualenv, but the native system packages (due to virtually no dependencies).

With this upgrade the Webapp the following Bug was introduced:

  1. Authenticate
  2. Open up a "long" Sieve-Skript (in our case: about 900 lines)
  3. The Connection between WebApp and Sieve-Server gets terminated.

What did you expect to happen?

  • The connection shouldn't have been terminated.

Logs and Traces

We redirect our logging to Journald and I turned up the loglevel to logging.DEBUG

Aug 11 09:18:23 python3[223370]: 2023-08-11 09:18:23 INFO [handle_request] websocket.py : Websocket Request for /websocket/REDACTED
Aug 11 09:18:33 python3[223370]: 2023-08-11 09:18:33 DEBUG [run] messagepump.py : bytearray(b'AUTHENTICATE "PLAIN" REDACTED"\r\n')
Aug 11 09:18:33 python3[223370]: 2023-08-11 09:18:33 DEBUG [run] messagepump.py : b'OK "Logged in."\r\n'
Aug 11 09:18:33 python3[223370]: 2023-08-11 09:18:33 DEBUG [run] messagepump.py : bytearray(b'LISTSCRIPTS\r\n')
Aug 11 09:18:33 python3[223370]: 2023-08-11 09:18:33 DEBUG [run] messagepump.py : b'"managesieve" ACTIVE\r\nOK "Listscripts completed."\r\n'
Aug 11 09:18:38 python3[223370]: 2023-08-11 09:18:38 DEBUG [run] messagepump.py : bytearray(b'GETSCRIPT "managesieve"\r\n')
Aug 11 09:18:38 python3[223370]: 2023-08-11 09:18:38 DEBUG [run] messagepump.py : b'{32169}\r\n' ...

the script follows in 8 blocks

Aug 11 09:18:39 python3[223370]: 2023-08-11 09:18:39 DEBUG [run] messagepump.py : bytearray(b'CHECKSCRIPT {32169+}\r\nrequire "copy"; ...

a part of the script follows

Aug 11 09:18:39 python3[223370]: 2023-08-11 09:18:39 DEBUG [__exit__] sievesocket.py : <class 'Exception'>
Aug 11 09:18:39 python3[223370]: 2023-08-11 09:18:39 DEBUG [__exit__] sievesocket.py : Client to server messages have to be masked.
Aug 11 09:18:39 python3[223370]: 2023-08-11 09:18:39 DEBUG [__exit__] sievesocket.py : <traceback object at 0x7f75b8941ec0>
Aug 11 09:18:39 python3[223370]: 2023-08-11 09:18:39 DEBUG [__exit__] websocket.py : On Exit
Aug 11 09:18:39 python3[223370]: 2023-08-11 09:18:39 WARNING [handle_message] webserver.py : Client to server messages have to be masked.
Aug 11 09:18:39 python3[223370]: 2023-08-11 09:18:39 WARNING [handle_message] webserver.py : Traceback (most recent call last):
Aug 11 09:18:39 python3[223370]:   File "/opt/thsmi/sieve/sieve-0.6.1-web/script/webserver.py", line 65, in handle_message
Aug 11 09:18:39 python3[223370]:     handler.handle_request(context, request)
Aug 11 09:18:39 python3[223370]:   File "/opt/thsmi/sieve/sieve-0.6.1-web/script/handler/websocket.py", line 48, in handle_request
Aug 11 09:18:39 python3[223370]:     MessagePump().run(websocket, sievesocket)
Aug 11 09:18:39 python3[223370]:   File "/opt/thsmi/sieve/sieve-0.6.1-web/script/messagepump.py", line 26, in run
Aug 11 09:18:39 python3[223370]:     data = server.recv()
Aug 11 09:18:39 python3[223370]:   File "/opt/thsmi/sieve/sieve-0.6.1-web/script/websocket.py", line 145, in recv
Aug 11 09:18:39 python3[223370]:     raise Exception("Client to server messages have to be masked.")
Aug 11 09:18:39 python3[223370]: Exception: Client to server messages have to be masked.

Which Version

Include information about your system, server and most important if it is about the app or webextension.

  • WebApp on latest commit
  • Operating system: Linux (Browser: Firefox/Chromium)
  • The mail-server runs Pigeonhole via Dovecot 2.3.20.
  • We are running a small patch according to #874
  • The loglevel has been set to logging.DEBUG

As addition: This is not an issue on short Sieve-Scripts.