• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Deadlock reading the object model from a plugin

Scheduled Pinned Locked Moved
Plugins for DWC and DSF
3
16
607
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    Ant1 @Ant1
    last edited by 17 Oct 2024, 08:44

    @Ant1 Hey! Unfortunately the issue just happened again today 😕

    Here is information with regard to my configuration:
    FirmwareVersion.png
    config.g

    And here are some information about the plugin that I am developping. I only included the interception part, but if you want to see the other files I can share.
    plugin.json
    intercept.py

    undefined 1 Reply Last reply 17 Oct 2024, 09:27 Reply Quote 0
    • undefined
      chrishamm administrators @Ant1
      last edited by 17 Oct 2024, 09:27

      @Ant1 Sorry to hear that. Did you see the same Resending packet #0 (request GetObjectModel) messages this time, too? Your config doesn't look terribly complex, so I find it surprising that you're running out of output buffer space - that's the only reason for that particular log message.

      You could try to disable PanelDue for testing purposes and check if the problem persists then. PanelDue, networking, and SBC interfaces share the same output buffer pool.

      Btw, you should cancel and discard the code being intercepted if flush returns false, else the code action may be still executed even though the underlying code or (macro) file is already cancelled.

      Duet software engineer

      undefined 1 Reply Last reply 17 Oct 2024, 16:24 Reply Quote 0
      • undefined
        Ant1 @chrishamm
        last edited by Ant1 17 Oct 2024, 16:24

        @chrishamm
        Yes, it was the same issue with Resending package #0.
        Okay I will check if disabling the PanelDue works.
        And thank you for the tip, I will add that line of code to the plugin.

        undefined 1 Reply Last reply 17 Oct 2024, 16:27 Reply Quote 0
        • undefined
          Ant1 @Ant1
          last edited by 17 Oct 2024, 16:27

          @Ant1 Oh and by the way, we also observed a new, more concerning issue with the plugin. When resuming the GCode execution after a custom command has been intercepted by my plugin, the printer shifts everything vertically, which basically makes the print fail.

          I have checked the GCode, and there is always an instruction G1 Z... after the call to the macro that gets intercepted, so the machine should move to a specific height. But instead, it moves 1 or 2mm higher than that and it prints in the air.

          We have checked, and this issue only happens when the plugin is activated. Could it also be some kind of synchronization issue between the plugin and the duet ? I am kinda lost on this one...

          undefined 1 Reply Last reply 18 Oct 2024, 10:56 Reply Quote 0
          • undefined
            chrishamm administrators @Ant1
            last edited by 18 Oct 2024, 10:56

            @Ant1 I can't see what happens in your control class but maybe you open a second command connection and send instructions to a different channel instead of the channel where the code is intercepted. If you have relative positioning on the channel where the code is intercepted from (e.g. DWC -> HTTP channel), absolute positioning may be still set on the default code channel for commands (SBC channel).

            I generally recommend you use only the intercept connection to send further commands before resuming regular execution. Btw, there seems to be an issue with blocking message boxes that I still need to fix. I've already logged it here:
            https://github.com/Duet3D/DuetSoftwareFramework/issues/207

            chrishamm created this issue 18 Oct 2024, 10:55 in Duet3D/DuetSoftwareFramework

            closed [Bug]: M291 from intercepted codes can lead to deadlocks #207

            Duet software engineer

            undefined 1 Reply Last reply 18 Oct 2024, 11:36 Reply Quote 1
            • undefined
              Ant1 @chrishamm
              last edited by 18 Oct 2024, 11:36

              @chrishamm Thanks for your issue on GitHub! Is there any way I could help tracking it down ?

              Regarding the command connection, I am passing the intercept connection to the different parts of my plugin so that all the commands are sent through it, so this should be working, right ?

              The weird thing is that this issue happens randomly. That is, if I launch the same GCode several times in a row, it might succeed, or fail, but at different places. The only common denominator is that it fails to move at the right height after it resumes execution from my plugin.

              undefined 1 Reply Last reply 18 Oct 2024, 11:44 Reply Quote 0
              • undefined
                chrishamm administrators @Ant1
                last edited by 18 Oct 2024, 11:44

                @Ant1 said in Deadlock reading the object model from a plugin:

                Is there any way I could help tracking it down ?

                Not yet, I need to have a look at this problem again in detail before I can comment on it further. If you can, offload the M291 logic to a separate macro for now and invoke that using M98 instead. A quick fix for a blocking M291 request from a custom code might be to prioritize M292, however I need evaluate that option again. I'll keep you posted.

                @Ant1 said in Deadlock reading the object model from a plugin:

                Regarding the command connection, I am passing the intercept connection to the different parts of my plugin so that all the commands are sent through it, so this should be working, right ?

                Not necessarily. When you run further codes on the same channel but using a different command connection, those codes are queued behind the code that is being intercepted. By sending codes through the intercept connection instead, you can ensure that those codes are executed before the code being intercepted finishes. Perhaps that side-effect upsets your custom logic.

                Duet software engineer

                undefined 1 Reply Last reply 18 Oct 2024, 13:03 Reply Quote 0
                • undefined
                  Ant1 @chrishamm
                  last edited by 18 Oct 2024, 13:03

                  @chrishamm
                  Yes, that's what I meant, currently my InterceptConnection is shared between all the modules of my code, so that all the commands get executed before the interception finishes.

                  What is weird though is that we used to have a separate CommandConnection in a previous version of the plugin and that bug never happened back then...

                  undefined 1 Reply Last reply 18 Oct 2024, 14:45 Reply Quote 0
                  • undefined
                    chrishamm administrators @Ant1
                    last edited by 18 Oct 2024, 14:45

                    @Ant1 I've got fixes ready for the message box deadlock in the DSF v3.5 and v3.6 branches. Prioritizing M292 does indeed fix it. That lets me run your test.py script without problems.

                    If you want to diagnose the order of codes being processed, either check out the CodeLogger utility in /opt/dsf/bin or enable debug logging via /opt/dsf/conf/config.json.

                    Duet software engineer

                    undefined 1 Reply Last reply 23 Oct 2024, 15:30 Reply Quote 1
                    • undefined
                      Ant1 @chrishamm
                      last edited by 23 Oct 2024, 15:30

                      @chrishamm Okay thanks for all the pointers ! I switched all my machines to 3.5.3 and made the changes with the connections that you suggested, and it solves most of my problems.

                      For the problem that I mentionned due to the machine being shifter along the Z axis after executing a macro from the plugin, I found something that might have caused the issue:

                      When intercepting a command inside the plugin, I was always starting by sending G90 and M83 to the machine to make sure that whatever mode it is in, I can always perform moves and extrusions in absolute and relative mode, respectively. I suspect that those two commands might have caused the machine to shift position along Z due to synchronization issues because I removed them and the issue never happened again...

                      1 Reply Last reply Reply Quote 1
                      16 out of 16
                      • First post
                        16/16
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA