E3F5 exception related to deserializing issue · Issue #159 · funkyfuture/deck-chores · GitHub
[go: up one dir, main page]

Skip to content

exception related to deserializing issue #159

@pgee70

Description

@pgee70

This is a bit of a tricky one.
I work in a team with the sole mac (Apple M2 Max OSX 15.5 (24F74)) and i have an issue with deck-chores.
we set up deck chores via docker compose.yml with

  tasks:
    container_name: "${COMPOSE_PROJECT_NAME}-task-scheduler"
    image: ghcr.io/funkyfuture/deck-chores:1
    restart: unless-stopped
    environment:
      TIMEZONE: Australia/Hobart
      LABEL_NAMESPACE: cron
      DEBUG: yes

    volumes:
      - ${DOCKER_SOCK}:/var/run/docker.sock:z

in my case DOCKER_SOCK=/Users/pgee/.docker/run/docker.sock

then we trigger the job with:

      cron.sap-webserver-enqueued-emails.command: "php /var/www/html/sap-backend/index.php cron process_enqueued_emails"
      cron.sap-webserver-enqueued-emails.interval: "every minute"
      cron.sap-webserver-enqueued-emails.user: "www-data"
      

the php script being called gives no errors.
When this container is run on windows/intel computers and on our red-hat severs, it functions perfectly.

The issue is on the mac/apple silicon. I start up the containers, and the command runs the first time.
on subsequent triggers, it fails.

2025-07-28 23:40:00,929|DEBUG   |Parsing labels: {'com.docker.compose.config-hash': '933840c019a67ceb89023dd3f91249d5db9392b2f1103f579722521170bb08df', 'com.docker.compose.container-number': '1', 'com.docker.compose.depends_on': '', 'com.docker.compose.image': 'sha256:e2306dbeddb7901fb3f08bb0c8e5896ef816e8d53f6bdd82ffb538e5fc5a725e', 'com.docker.compose.oneoff': 'False', 'com.docker.compose.project': 'npc', 'com.docker.compose.project.config_files': '/Users/pgee/utas/npc/npc-webserver/docker-compose.yml,/Users/pgee/utas/npc/npc-webserver/develop.yml', 'com.docker.compose.project.working_dir': '/Users/pgee/utas/npc/npc-webserver', 'com.docker.compose.service': 'phpmyadmin', 'com.docker.compose.version': '2.38.2', 'org.opencontainers.image.authors': 'The phpMyAdmin Team <developers@phpmyadmin.net>', 'org.opencontainers.image.description': 'Run phpMyAdmin with Alpine, Apache and PHP FPM.', 'org.opencontainers.image.documentation': 'https://github.com/phpmyadmin/docker#readme', 'org.opencontainers.image.licenses': 'GPL-2.0-only', 'org.opencontainers.image.source': 'https://github.com/phpmyadmin/docker.git', 'org.opencontainers.image.title': 'Official phpMyAdmin Docker image', 'org.opencontainers.image.url': 'https://github.com/phpmyadmin/docker#readme', 'org.opencontainers.image.vendor': 'phpMyAdmin', 'org.opencontainers.image.version': '5.2.1', 'traefik.http.routers.phpmyadmin.rule': 'Host(`phpmyadmin.docker.localhost`)'}
2025-07-28 23:40:00,929|DEBUG   |Considering labels for service id: {'com.docker.compose.project': 'npc', 'com.docker.compose.service': 'phpmyadmin'}
2025-07-28 23:40:00,957|DEBUG   |Considering labels for job definitions: {}
2025-07-28 23:40:00,957|DEBUG   |Job definitions: {}
2025-07-28 23:40:00,957|DEBUG   |Assigning service id: ('com.docker.compose.project=npc', 'com.docker.compose.service=phpmyadmin')
2025-07-28 23:40:00,961|DEBUG   |Parsing labels: {'com.docker.compose.config-hash': 'bb54983b64dff0ffa4dfa500ede5113706bbd32a3bafc172c3f94814af3a08e0', 'com.docker.compose.container-number': '1', 'com.docker.compose.depends_on': '', 'com.docker.compose.image': 'sha256:b15f1362843f2ef7a6946291a80de3cf122639619d18573ef84ee5d0fb320ff7', 'com.docker.compose.oneoff': 'False', 'com.docker.compose.project': 'npc', 'com.docker.compose.project.config_files': '/Users/pgee/utas/npc/npc-webserver/docker-compose.yml,/Users/pgee/utas/npc/npc-webserver/develop.yml', 'com.docker.compose.project.working_dir': '/Users/pgee/utas/npc/npc-webserver', 'com.docker.compose.service': 'database', 'com.docker.compose.version': '2.38.2', 'org.opencontainers.image.authors': 'MariaDB Community', 'org.opencontainers.image.base.name': 'docker.io/library/ubuntu:jammy', 'org.opencontainers.image.description': 'MariaDB Database for relational SQL', 'org.opencontainers.image.documentation': 'https://hub.docker.com/_/mariadb/', 'org.opencontainers.image.licenses': 'GPL-2.0', 'org.opencontainers.image.ref.name': 'ubuntu', 'org.opencontainers.image.source': 'https://github.com/MariaDB/mariadb-docker', 'org.opencontainers.image.title': 'MariaDB Database', 'org.opencontainers.image.url': 'https://github.com/MariaDB/mariadb-docker', 'org.opencontainers.image.vendor': 'MariaDB Community', 'org.opencontainers.image.version': '11.2.6'}
2025-07-28 23:40:00,961|DEBUG   |Considering labels for service id: {'com.docker.compose.project': 'npc', 'com.docker.compose.service': 'database'}
2025-07-28 23:40:00,975|DEBUG   |Considering labels for job definitions: {}
2025-07-28 23:40:00,975|DEBUG   |Job definitions: {}
2025-07-28 23:40:00,975|DEBUG   |Assigning service id: ('com.docker.compose.project=npc', 'com.docker.compose.service=database')
2025-07-28 23:40:00,975|DEBUG   |Finished inspection of running containers.
2025-07-28 23:40:00,976|INFO    |Added job "moodle-webserver-cron" to job store "default"
2025-07-28 23:40:00,977|INFO    |Added job "sap-webserver-daily" to job store "default"
2025-07-28 23:40:00,977|INFO    |Added job "sap-webserver-enqueued-emails" to job store "default"
2025-07-28 23:40:00,977|INFO    |Scheduler started
2025-07-28 23:40:00,977|DEBUG   |Looking for jobs to run
2025-07-28 23:40:00,977|DEBUG   |Next wakeup is due at 2025-07-29 09:41:00.864459+10:00 (in 59.887182 seconds)
2025-07-28 23:40:00,977|INFO    |Listening to events.
2025-07-28 23:41:00,870|DEBUG   |Looking for jobs to run
2025-07-28 23:41:00,872|INFO    |npc-php82-moodle: Executing 'moodle-webserver-cron'.
2025-07-28 23:41:00,872|DEBUG   |Next wakeup is due at 2025-07-29 09:41:00.904445+10:00 (in 0.031684 seconds)
2025-07-28 23:41:00,905|DEBUG   |Looking for jobs to run
2025-07-28 23:41:00,906|INFO    |npc-php82-sap: Executing 'sap-webserver-enqueued-emails'.
2025-07-28 23:41:00,906|DEBUG   |Next wakeup is due at 2025-07-29 09:42:00.864459+10:00 (in 59.957914 seconds)
2025-07-28 23:41:00,916|ERROR   |Caught an unhandled exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/deck_chores/main.py", line 320, in main
    listen(since=last_event_time + timedelta(microseconds=1))
  File "/usr/local/lib/python3.12/site-packages/deck_chores/main.py", line 195, in listen
    event = json.loads(event_json)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
               ^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 4041 (char 4040)

it looks to me like line 188 of https://github.com/funkyfuture/deck-chores/blob/main/deck_chores/main.py is the issue.
so i edited the python code to debug what is going on, and the event_json variable was terminated at about 4k characters. It seems to me like the stream is not being read until completion because the json string that is decoded into was not complete.

i am not familiar with python streams and if this an issue with this code, or the docker.types.daemon.CancellableStream from https://docker-py.readthedocs.io/en/stable/client.html is at fault. in some languages, just concatentating string.empty to the stream is enough to make it read to completion, i tried that but it didn't work in this case.

Anyway reporting this to see if you can help me, or at least to record what is going on for someone else to find.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0