Menu

#468 GTK2 client, scripting: don't call script_monitor if must_send would drop the command

None
closed
None
5
2025-07-17
2025-07-11
Saiapatsu
No

must_send 0 causes bogus monitor messages for dropped commands to be sent to client scripts, which makes comc usage in scripts (without sync, which I haven't experimented with) touchy and unreliable. This patch moves script_monitor to only the code paths where the command is actually issued.

The comment, "// moved here to avoid having to reimplement must_send in scripts" can be omitted.

This patch was based on commit 17769c06c8b815c65fdb310c2500bb6da6f21477 from 2021, but I didn't get any merge conflicts when applying it to a recent (couple of weeks ago) source.

1 Attachments

Discussion

  • Kevin Zheng

    Kevin Zheng - 2025-07-11

    Thanks for the patch. This looks fine to me. Though I wonder, what do you mean by "comc usage in scripts touchy and unreliable?" Each ncom command has a number that the server sends back in comc to confirm completion of that command, so you can always track which commands have been executed.

     
  • Kevin Zheng

    Kevin Zheng - 2025-07-14
    • status: open --> feedback-needed
    • assigned_to: Kevin Zheng
    • Group: -->
     
  • Saiapatsu

    Saiapatsu - 2025-07-15

    Sorry, instead of "touchy and unreliable" I meant "practically impossible". When the client drops a sent command but still notifies scripts as if it had been sent, any script that increments its own ncom counter (because you cannot ever know the client's actual ncom state) will go out of sync unrecoverably. From what I've seen glancing at the client source, sync is supposed to deal with this, but I haven't looked into how it works yet. The scripting interface should have sent ncom with each monitored command (-1 in old protocols) instead of forcing scripts guess ncom, which would also make this functionality a lot more discoverable.

     
  • Kevin Zheng

    Kevin Zheng - 2025-07-17
    • status: feedback-needed --> closed
     
  • Kevin Zheng

    Kevin Zheng - 2025-07-17

    Committed, with changes. Thanks!

     

Log in to post a comment.

MongoDB Logo MongoDB