INTI-CMNB / KiBot

KiCad automation utility
GNU Affero General Public License v3.0
550 stars 65 forks source link

[BUG] render3d can sometimes get confused on what filename to use, causes timeouts. #543

Closed oliv3r closed 8 months ago

oliv3r commented 8 months ago

When running the following yaml file in the latest kibot 7 full container in a CI, kicad gets confused and fails to save the file (see video in artifacts). Because of that (filename is a # only) kibot keeps waiting for the timeout, and then kills stuff.

Instead, kibot could check the intended filename, and see if it is valid at all.

I've noticed this issue in more flows, so I wonder, would it not be wiser, to save the file as a temporary, mktmpdir in python, check if all went well, store file with a random name there, and then when finished mv the tmp file to the intended destination? This would remove quite a few of these errors, in that the GUI kicad will have a super reliable way to generate the needed file ...

kibot:
  version: 1

global:
  environment:
    models_3d: '${KIPRJMOD}/packages3D'
  filters:
    - filter: 'KiCad 7 does not have environment.vars anymore. kibot#528'
      number: 9
      regex: 'KiCad config without environment.vars section'

preflight:
  run_drc: false
  run_erc: false

outputs:
  - name: 'render_3d_bottom'
    comment: "Exports the image generated by KiCad's 3D viewer."
    type: 'render_3d'
    dir: 'outputs/render3d'
    options: &render_options
      auto_crop: true
      background1: '#66667f'
      background2: '#cccce5'
      board: '#332b16'
      clip_silk_on_via_annulus: true
      copper: '#8b898c'
      dnf_filter: '_none'
      download: false
      height: 1024
      highlight: []
      move_x: 0
      move_y: -3
      move_z: 0
      no_smd: false
      no_tht: false
      no_virtual: false
      orthographic: false
      pre_transform: '_none'
      ray_tracing: true
      realistic: true
      rotate_x: 0
      rotate_y: 0
      rotate_z: 0
      show_adhesive: false
      show_board_body: true
      show_comments: false
      show_components: all
      show_eco: false
      show_silkscreen: true
      show_soldermask: true
      show_solderpaste: true
      show_zones: true
      silk: '#d5dce4'
      solder_mask: '#208b4780'
      solder_paste: '#808080'
      subtract_mask_from_silk: true
      transparent_background: false
      transparent_background_color: '#00ff00'
      transparent_background_fuzz: 15
      variant: ''
      view: 'bottom'
      wait_render: -600
      width: 1440
      zoom: 6
  - name: 'render_3d_front'
    comment: "Exports the image generated by KiCad's 3D viewer."
    type: 'render_3d'
    dir: 'outputs/render3d'
    options:
      <<: *render_options
      move_x: 0
      move_y: -2
      move_z: 0
      rotate_x: -5
      rotate_y: 0
      rotate_z: -2
      view: 'front'
      zoom: 4
  - name: 'render_3d_top'
    comment: "Exports the image generated by KiCad's 3D viewer."
    type: 'render_3d'
    dir: 'outputs/render3d'
    options:
      <<: *render_options
      move_x: 0
      move_y: -3
      move_z: 0
      rotate_x: 0
      rotate_y: 0
      rotate_z: 0
      view: 'top'

See https://gitlab.com/olliver/lapod/-/jobs/5836088538 and/or https://gitlab.com/olliver/lapod/-/pipelines/1122395553

What's interesting from the logs, is that kibot actually tries to name the file '#'

 INFO:Paste bogus short name (#)

but why? I think that confuses kicad, though the dialog does exit normally. The vrml issue also does the same, but doesn't print that in its logs ... later though, the timeout kill is of course on the actual filename, which wasn't used of course ...

> RuntimeError: Timed out waiting for `['IO:close:/builds/olliver/lapod/breakout_hdmi/outputs/render3d/breakout_hdmi-3D_bottom.png']`
oliv3r commented 8 months ago

Here'st he interposer log from the pipeline, probably best to attach it to the issue so it don't get lost.

pcbnew_interposer.log

with the most interesting bits here:

PANGO:tmp2gwix2eu.png
PANGO:#
KiAuto:match
KiAuto:Waiting for `['GLX:Swap']` starts=True times=1
IO:open:/tmp/.icons/default/cursors/left_ptr
IO:fopen:r
IO:open:/tmp/.icons/default/index.theme
IO:fopen:r
IO:open:/usr/share/icons/default/cursors/left_ptr
IO:fopen:r
IO:open:/usr/share/icons/default/index.theme
IO:fopen:r
IO:open:/usr/share/pixmaps/default/cursors/left_ptr
IO:fopen:r
IO:open:/usr/share/pixmaps/default/index.theme
IO:fopen:r
KiAuto:Waiting for `['GLX:Swap']` starts=True times=1
KiAuto:Waiting for `['GTK:Window Destroy:3D Image File Name']` starts=False times=1
PANGO:Appearance
PANGO:Selection Filter
PANGO:Appearance
PANGO:Selection Filter
* wrapping file chooser get filename
GTK:Filename:/builds/olliver/lapod/breakout_hdmi/outputs/render3d/breakout_hdmi-3D_bottom.png
GTK:Filename:**Changed from /builds/olliver/lapod/breakout_hdmi/#
GTK:Main:Out
GTK:Window Set Modal:3D Image File Name 0
GTK:Filename:/builds/olliver/lapod/breakout_hdmi/outputs/render3d/breakout_hdmi-3D_bottom.png
GTK:Filename:**Changed from /builds/olliver/lapod/breakout_hdmi/#
set-soft commented 8 months ago

This is the same as #544