Author Topic: [v1.8.3.29] Attempting to switch to multiple profiles at once causes issues  (Read 2388 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
(The majority of this post is a copy of those on Discord, kept here so the issue can more easily be tracked)


v1.8.3.29 looks good for profile switch actions, but it occurred to me "Profile.SwitchTo()" could be an issue, and it is.

It appears to be a race condition, as sometimes the profile that becomes active is the one selected using the "Profile" dropdown, whereas other times it's the profile the inline function is set to switch to. However, unlike the action's behavior in v1.8.3.28, this switch only appears to happen once.
There is no log message produced in either case for the switch to the profile set in the inline function (I.E. regardless of which profile actually ends up as active)


At a certain point I had the "Profile" dropdown and the "Edit Profile" button lock up when attempting to use both the action and the inline function to switch simultaneously, but at some point during testing I got a dialog window noting the profile database couldn't be read and VoiceAttack had to close (so presumably it got corrupted and reverted to a backup), and I haven't been able to replicate that since. which is difficult to replicate reliably, but it does happen still.

In this state, the "More Profile Action" button remains usable, and if a new profile is created and saved, the "Edit Profile" button is also re-enabled. The "Profile" dropdown does switch to the newly created profile, but otherwise remains disabled and cannot be interacted with.


Somewhat related: When running an inline function that switches profiles using the "Test Run" button, "Profile cannot be changed while editing.  Close the, 'Edit a Profile' screen in order to change profiles." is written to the log, and the active profile does not actually change, however the "Profile" dropdown does then show the profile it attempted to switch to.



Trying to combine the action with an inline function in a profile that does not have an unload command has no adverse effects when the command is executed if the inline function is below the "Switch to Another Profile", as the command is stopped at that action.

If the order is reversed, however, VoiceAttack will freeze when the command is executed (the GUI stops responding, tooltips remain in place, and it does not appear to respond to spoken, nor keyboard-triggered commands; CPU usage in this state varies (though it is not unusually high), and it can unfreeze after a while, but that doesn't happen most of the time (as far as I can observe over several minutes).
Using task manager to end the task (from the "Processes" tab) can result in an improper shutdown message, but may also momentarily unfreeze VoiceAttack, as the log sometimes updates right before it shuts down.

The above occurs when the inline function runs asynchronously.
Interestingly, if it's running synchronously, the GUI does not freeze, but VoiceAttack will not respond to (spoken or keyboard) commands (the input volume bar does move), and the "Edit a Profile" window will not open when clicking the "Edit Profile" button.
Switching to another profile breaks out of this state.


I should mention using an asynchronous inline function by itself to switch between multiple profiles just does exactly that (even with upwards of ten profiles it just switches back and forth and ends up at the last one it's set up to switch to).
Switching to multiple profiles using only a synchronous inline function and the "Switch to Another Profile" action disabled results in the same "zombie" state as a combination of the inline function and the action.



Using a batch file to switch profiles twice does not exhibit this effect, and it only appears to respond to one of the requests, either switching to one of the profiles randomly, or switching between them if one is already the active profile.
E.G. if "Profile C" is active, trying to switch to "Profile A" and "Profile B" may result in either of the latter two becoming the active profile; if instead "Profile A" is active, "Profile B" will become active, and vice-versa.