microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.94k stars 8.22k forks source link

Execution on hold until tab is selected/focused #13136

Open matbech opened 2 years ago

matbech commented 2 years ago

Windows Terminal version

1.12.10983.0

Windows build number

10.0.22621.1

Other Software

No response

Steps to reproduce

I'm opening 12 tabs in the same WT window, like this:

for %%G in (boost wtl openssl asio taocpp-json ctre scnlib nanosvg wil detours lexilla) do (
    wt --maximized -w 1 new-tab --title "%%G" -d "%%G" "%~dp0%%G\update.cmd"
)

Expected Behavior

All tabs/commands should run in parallel, without needing to select the tab first.

Actual Behavior

Under some circumstances (it doesn't happen always, no reliable way to reproduce), the commands only start until the tab is being selected/focused.

This behavior does not happen when wt.exe is called once with all the new-tab commands separated by ;

zadjii-msft commented 2 years ago

You know, I do see this from time to time when restoring the Terminal session. Basically, the pane needs to be displayed in the UI tree once to actually get started, so for something that's creating a bunch of tabs/panes all at once, only the one that ends up displayed starts.

For things like just running a shell it's not too punishing, but for starting any sort of background script, yea it sucks.

We should figure this out.

Thanks!

Hukuma1 commented 2 years ago

I'm not sure if it's related, but I also open WT with 4 split panes and another tab. Prior releases used to load immediately and now I almost have WT hanging/not responding for 5 seconds. It used to load just fine, the console would appear a bit after as it connected. Now it seems to try to wait for everything to load in the background (e.g. connecting to servers) before drawing the screen. Is there anyway to go back to the previous behavior? Or figure out this rendering block?

brupelo commented 5 months ago

As mentioned in the related #16896 I encountered an unexpected behavior while setting up a local microservices cluster using wt and I wanted to share it here.

While attempting to spin up a local microservices cluster, I encountered unexpected 500 errors. After some investigation, I realized that the issue stemmed from the tab activation behavior in wt. In my setup, I had dockerized the microservices resources in one tab, and in other tabs, I was spinning up individual web servers for the services. However, I noticed that the tab processes were not starting automatically unless I explicitly clicked on them.

This behavior seemed unusual to me, as I assumed that the tab processes should start automatically without requiring manual intervention. Hence, I suspect it might be a bug rather than intended behavior.

I mean, I'm under the assumption the intended behaviour would be spinning up the tab processes in parallel (without any dependencies between them)

That said, this one is pretty annoying cos sometimes you're switching a lot of branches and want to try different versions of the cluster by respawning this multi-tab setup but you forget to click in all tabs (~10) so you end up context switching, etc... 😅

brupelo commented 5 months ago

Just for the sake of completeness, the syntax I'm using is slightly different to this thread's reproducer, ie:

run_services.cmd

wt -w %~n0 ^
nt --title="shared" --startingDirectory=%ALIAS_DIR% %COMMAND_SHARED% ; ^
nt --title="svc0:5000" --startingDirectory=%svc0% %COMMAND% ; ^
nt --title="svc1:5001" --startingDirectory=%svc1% %COMMAND% ; ^
nt --title="svc2:5002" --startingDirectory=%svc2% %COMMAND% ; ^
nt --title="svc3:5003" --startingDirectory=%svc3% %COMMAND% ; ^
nt --title="svc4:5005" --startingDirectory=%svc4% %COMMAND% ; ^
nt --title="svc5:5006" --startingDirectory=%svc5% %COMMAND% ; ^
nt --title="svc6:5007" --startingDirectory=%svc6% %COMMAND% ; ^
nt --title="svc7:5009" --startingDirectory=%svc7% %COMMAND%

But I guess we're talking about the same bug as @zadjii-msft already marked it as dup.