Was looking for more of an issue tracker for Edge...
I've run into this issue with edge, that actually chrome shares.
With a few batch files...
setupTask.bat
schtasks /create /tn @EdgeShutdownTest\runEdge /tr %~dp0msedge.bat /sc ONCE /st 00:00 /sd 01/01/2000
msedge.bat
start /wait "Title" "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --user-data-dir=c:\temp\edge-1 %*
test.bat
schtasks /run /tn @EdgeShutdownTest\runEdge
and probably endTest.bat
schtasks /delete /tn @EdgeShutdownTest\runEdge /f
setupTask creates a scheduled task that calls the msedge.bat in the same directory; scheduled tasks can't have arguments (don't seem to take arguments) so anything has to be done through a batch file or other simple task. the msEdge.bat just starts an instance of edge with start /wait
so while edge is running, the batch file waits, and when you close the window (I use ctrl-W to close the tab, the X works, alt-F4, whatever), then the batch file completes and exits.
Test.bat triggers the batch file to run.... This can be monitored in the process group of the scheduler.
I was using task explorer from https://github.com/DavidXanatos/TaskExplorer Releases v 1.5.6 to watch the processes be created.
These are demonstrations that it does happen - it's a timing sensitive problem though; then I'll describe the issue.
https://youtu.be/ZrrDHJb0Khk is a demonstration of what I mean...
https://youtu.be/NCPdc77pSJQ continues with an example of having edge already there, then when the batch file runs, it immediately exits, but an edge window does show... a false exit is as bad as a failure to exit.....
At least the above is what should happen. What does happen is
- Sometimes when you close the edge tab/browser, the background edge process does not exit, so there's no visible UI available to do anything, and yet edge is still running in the background, and the batch file does not end. You can manually kill edge with task manager or the task explorer above, and then the batch file completes, and the test can trigger again. In this condition, the scheduled task is still running, and triggering with test.bat again does nothing.
- Sometimes, after a period of time, when you close the tab, edge starts another edge with the command line flag '--no-top-window', and the process list maintained by the task explorer above has a terminated cmd.exe and a terminated edge that then has this new edge under it. It doesn't get the original flags of
--user-data-dir=
, and the window that it has is a blank name, and most msedge processes do not have windows. I would be hard pressed to find this if I just start, because the parent process ID references a process that doesn't exist now, and without continuous monitoring it would be hard to establish that this chain of edge processes is the one that is bad. When this happens, the edge process did end, and the batch file ends, and the scheduled task can be run again. A new window is created, but the msedge that gets started by the batch file immediately exits after handing the work off to the existing msedge process; so the schedule task can be triggered again, the batch file thinks it exited, but it still exists on the screen. It might be tempting to run test.bat many more times, which will cause repeated tabs to be opened (if they have URL specified in the msedge.bat file; I think maybe the home screen auto collapses, but it can be that many many tabs can be open)
The above is actually done in a process that launches a browser to a webpage in kiosk mode, and can track the process, and perhaps receive update commands etc. The batch files demonstrate the behavior without involving the actual process, which is more elegant then it may seem from the above minimal test procedure.
I was testing on a slower box, a modern N100 processor with DDR5 memory and SSD disk - it's a nice little box, very fast memory; cpu is a little slow on a large compile, but runs edge just fine and the intended application.
When I was testing on my 13700K system, I couldn't get the behavior to happen, it's part of the videos above though, it does attempt to do the same thing, but is able to stop the processes it created. And maybe it's not after a time delay that it happens, maybe it's at a time when a new process gets created.
I did go through the initial setup - the msedge.bat contains a --user-data-dir which ends up having to do a first-run initialization to select importing data (don't), improve browsing experience( not needed), selecting a theme (probably not relevant to the issue), and then getting to the browser itself... which in this case is just there to be closed.