HTTP-Shortcuts icon indicating copy to clipboard operation
HTTP-Shortcuts copied to clipboard

App gets into shortcut execution loop

Open mpiffault opened this issue 2 years ago • 3 comments

Steps To Reproduce

  1. Launch a shortcut (from an alias on the home or for inside HTTP shortcuts) with a showDialog action in scripting.
  2. Click OK button to dismiss the dialog

Expected behavior

The dialog window is dismissed and the control is handed back to the user.

Actual behavior

The dialog window is dismissed, but the shortcut is automatically relaunched just after and it stays in a loop state until HTTP Shortcut is killed manually. After that, just launching HTTP shortcut launches the shortcut again.

Recovering

It's possible to recover control by quickly taping OK and trying to modify the shortcut in question. It takes a lot of attempts to succeed. After that, it's possible to relaunch the incriminated shortcut without problem. I suppose I launched it in a certain manner which put it in an unexpected state. I couldn't reproduce it for now.

Context

  • Android OS Version: 13
  • App Version 3.9
  • Installed via F-Droid official repos

mpiffault avatar Dec 23 '23 16:12 mpiffault

Thanks for the bug report. Unfortunately I'm not able to reproduce this either. But it does sound like something I've encountered before and is likely connected to the big topic of scheduling that I've been wanting to improve for a long time. In short, there's a bit of an issue with everything that has to do with shortcut execution scheduling, which includes the automatic repeating or delaying of shortcuts, as well as the "Wait for internet" feature.

If any of your shortcuts makes use of these scheduling features, or if you accidentally trigger a shortcut while another one is still executing, it can happen that the shortcuts will be restarted even though it is already running, which is probably what you've observed here. Currently I don't quite know how or why it happens. It's high up on my to do list though to investigate and fix the underlying issue.

Let me know if you manage to reproduce it again or gain other insights.

Waboodoo avatar Dec 23 '23 18:12 Waboodoo

By the way, in case the problem does happen again, there's an easier way to stop the app from going into the infinite loop after force stopping it. It is described here: https://http-shortcuts.rmy.ch/faq#infinite-loops

Waboodoo avatar Dec 23 '23 18:12 Waboodoo

With the help of you're link, which works perfectly well for this case, I could reproduce the case quite reliably by double tapping on a shortcut which structure is as such :

  • On pre-request scripting, it calls two other shortcuts sequentially (with executeShortcut) :
    • one to get location and store it in two global variables
    • one to call a endpoint to update a token
  • Effectively do the call using the informations gathered in the first step
  • On post-request scripting, it just parses the result and displays it in a dialog window

I'll try to reproduce it on a less specific case, but the pre-request operations combined with the fast double tap to launch seems to be the prerequisites to reproduce.

Hope this can help

mpiffault avatar Dec 23 '23 21:12 mpiffault