mkuf / prind

print in docker - Deploy a containerized Klipper Stack for your 3D Printer
GNU General Public License v3.0
324 stars 82 forks source link

Uploading truncates files #90

Closed craigcabrey closed 1 year ago

craigcabrey commented 1 year ago

This is quite a whacky issue I had to narrow down. For additional context, I am using the multiple printer custom compose file. Previously, I was using the standard setup with an Ender 3 S1 without any trouble (I haven't yet confirmed if the S1 instance is also experiencing this).

docker-compose.yaml (from prind 1.8.0):

[snip]
x-klipper-svc: &klipper-svc
  image: mkuf/klipper:latest
  restart: unless-stopped
  privileged: true
  volumes:
    - /dev:/dev
    - ./config:/opt/printer_data/config
    - run:/opt/printer_data/run
    - gcode:/opt/printer_data/gcodes
    - log:/opt/printer_data/logs

x-moonraker-svc: &moonraker-svc
  image: mkuf/moonraker:latest
  restart: unless-stopped
  volumes:
    - /dev/null:/opt/klipper/config/null
    - /dev/null:/opt/klipper/docs/null
    - ./config:/opt/printer_data/config
    - run:/opt/printer_data/run
    - gcode:/opt/printer_data/gcodes
    - log:/opt/printer_data/logs

x-ustreamer-svc: &ustreamer-svc
  image: mkuf/ustreamer:latest
  restart: unless-stopped
  command: --host=0.0.0.0 --port=8080 --slowdown --device=/dev/webcam --resolution=640x480 --format=MJPEG --desired-fps=30

## Service Definitions
services:

  ## Printer1
  ## Access api via port 8101/tcp and webcam via 8102/tcp
  slowboi-klipper:
    <<: *klipper-svc
    command: -I printer_data/run/slowboi.klipper.tty -a printer_data/run/slowboi.klipper.sock printer_data/config/slowboi.cfg -l printer_data/logs/slowboi.klippy.log
    labels:
      org.prind.service: klipper
      org.prind.printer: slowboi
  slowboi-moonraker:
    <<: *moonraker-svc
    command: -d printer_data -c printer_data/config/slowboi.moonraker.conf -l printer_data/logs/slowboi.moonraker.log
    ports:
      - 8101:7125
    labels:
      org.prind.service: moonraker
      org.prind.printer: slowboi
  slowboi-webcam:
    <<: *ustreamer-svc
    devices:
      - /dev/video0:/dev/webcam
    ports:
      - 8102:8080
    labels:
      org.prind.service: webcam
      org.prind.printer: slowboi

  ## Printer2
  ## Access api via port 8201/tcp and webcam via 8202/tcp
  hugeboi-klipper:
    <<: *klipper-svc
    command: -I printer_data/run/hugeboi.klipper.tty -a printer_data/run/hugeboi.klipper.sock printer_data/config/hugeboi.cfg -l printer_data/logs/hugeboi.klippy.log
    labels:
      org.prind.service: klipper
      org.prind.printer: hugeboi
  hugeboi-moonraker:
    <<: *moonraker-svc
    command: -d printer_data -c printer_data/config/hugeboi.moonraker.conf -l printer_data/logs/hugeboi.moonraker.log
    ports:
      - 8201:7125
    labels:
      org.prind.service: moonraker
      org.prind.printer: hugeboi

  ## Use Fluidd as Frontend
  fluidd:
    image: ghcr.io/fluidd-core/fluidd:latest
    restart: unless-stopped
    ports:
      - 80:80
    labels:
      org.prind.service: fluidd

volumes:
  run:
  gcode:
  log:

I uploaded a Calibration cube from PrusaSlicer (but also directly via Fluidd just to be sure) and the hash is different:

[craigcabrey@zephyrus Downloads]$ sha1sum xyzCalibration_cube_0.2mm.gcode 
6067b39f32f62ceb39c6b4fbe23d4fe8a2d22ef1  xyzCalibration_cube_0.2mm.gcode
root@klipper:/var/lib/docker/volumes/prind-180_gcode/_data/hugeboi/Calibration/PLA# sha1sum xyzCalibration_cube_0.2mm.gcode 
7761a530f74de2bd0433d544603849ccf3bf52d3  xyzCalibration_cube_0.2mm.gcode

It seems like roughly ~4k lines (not sure if there is a pattern here) went missing. I noticed this when my END_PRINT macro was nowhere to be found, but the pressure advance gcode I manually scp'd over did.

Any ideas welcome! For now, my workaround is to scp gcode over to my Pi but obviously I would much rather upload directly from within PrusaSlicer.

craigcabrey commented 1 year ago

I can confirm that the truncating issue happens to both printers.

[craigcabrey@zephyrus Downloads]$ sha1sum Pre-upload.gcode 
a20f3181f535207175fa6d7bd3782d6fb813ddce  Pre-upload.gcode
[craigcabrey@zephyrus Downloads]$ sha1sum Post-upload.gcode 
8403f72e886218f5d784b1e100f53932abce6392  Post-upload.gcode

example-gcode.zip

craigcabrey commented 1 year ago

I take back what I said about scp -- I see the same issue. scp'ing to the home dir goes fine (same hash), but then moving it into the docker volume changes the hash.

I'm not sure if I'm seeing the beginning of hardware failure or something funky with Docker volumes. Either way, it seems like it's not an issue with the software stack.