~ferdinandyb/throttle-devel

loglib.py looping endlessly on syntax error in config.toml

Maarten Aertsen <maarten@nlnetlabs.nl>
Details
Message ID
<D0I6HU2G7V8W.1IHOUPRG9Q9NH@nlnetlabs.nl>
DKIM signature
pass
Download raw message
Hi Bence,

This is unrelated to the patchset you just posted, but I managed to 
break things in new and exciting ways. So this started with me making a 
syntax error in config.toml, my fault. But instead of exiting 
immediately, the server gets into the endless loop below:

--Maarten

Traceback (most recent call last):
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/toml/decoder.py", line 511, in loads
    ret = decoder.load_line(line, currentlevel, multikey,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/toml/decoder.py", line 778, in load_line
    value, vtype = self.load_value(pair[1], strictly_valid)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/toml/decoder.py", line 849, in load_value
    raise ValueError("Found tokens after a closed " +
ValueError: Found tokens after a closed string. Invalid TOML.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/.local/bin/throttle-server", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/throttle_cli/cli_server.py", line 29, in main
    start_server(socketpath, loglevel)
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/throttle_cli/server.py", line 37, in start_server
    msgworker = CommandWorker(manager, ipcqueue, logqueue, comqueue)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/throttle_cli/commandworker.py", line 51, in __init__
    self.loadConfig()
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/throttle_cli/commandworker.py", line 63, in loadConfig
    config = toml.load(Path(configdir) / "config.toml")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/toml/decoder.py", line 134, in load
    return loads(ffile.read(), _dict, decoder)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/toml/decoder.py", line 514, in loads
    raise TomlDecodeError(str(err), original, pos)
toml.decoder.TomlDecodeError: Found tokens after a closed string. Invalid TOML. (line 5 column 1 char 214)
Whoops! Problem:
Traceback (most recent call last):
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/throttle_cli/loglib.py", line 23, in consumer
    record = queue.get()
             ^^^^^^^^^^^
  File "<string>", line 2, in get
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/managers.py", line 821, in _callmethod
    kind, result = conn.recv()
                   ^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 250, in recv
    buf = self._recv_bytes()
          ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 430, in _recv_bytes
    buf = self._recv(4)
          ^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 399, in _recv
    raise EOFError
EOFError
Whoops! Problem:
Traceback (most recent call last):
  File "~/.local/pipx/venvs/throttle-cli/lib/python3.12/site-packages/throttle_cli/loglib.py", line 23, in consumer
    record = queue.get()
             ^^^^^^^^^^^
  File "<string>", line 2, in get
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/managers.py", line 820, in _callmethod
    conn.send((self._id, methodname, args, kwds))
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 206, in send
    self._send_bytes(_ForkingPickler.dumps(obj))
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 427, in _send_bytes
    self._send(header + buf)
  File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/connection.py", line 384, in _send
    n = write(self._handle, buf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
BrokenPipeError: [Errno 32] Broken pipe

[BrokenPipeError repeating ad infinitum]
Reply to thread Export thread (mbox)