figwheel-main

RAMart 2023-08-07T10:22:42.060289Z

Hi y'all! 👋 Having some trouble adopting https://figwheel.org/docs/testing.html for the https://developer.chrome.com/articles/new-headless/: On macOS (13.5, Intel), chrome runs the tests but won't terminate. Looks more like a chrome issue to me to be honest, but maybe I just missed something important. Anyone successfully running tests using headless chrome (>=115) without chrome processes laying uselessly around afterwards?

RAMart 2023-08-10T06:01:51.085429Z

Yes. But the main point is "no --repl". And as far as i know, figwheel uses the repl to send a quit (or exit?) to end chrome after the tests. Both together fit into my picture: Chrome doesn't exit because it never receives the quit command because it doesn't listen on the repl (which means: stdin.) (I'm going to check my assumption with a little script-in-the-middle attack in the next days. Shouldn't be too hard to start chrome in the background, listen for quit on stdin and kill chrome via kill in the first place and a fancy DevTools-Command later.)

athomasoriginal 2023-08-07T13:03:01.264179Z

Hey! Yes, I just resolved this for our CI recently. The issue (as far as I understand): • chrome is run and immediately exits • figwheel-main doesn’t know chrome isn’t running and just keeps going (because it never receives a success/error msg) Solution I used:

path/to/chrome/bin --headless --remote-debugging-port=9222 :open-url

athomasoriginal 2023-08-07T13:03:43.828789Z

You can also try the above with “--headless=new” if you like and, if memory serves, that did work as well

RAMart 2023-08-07T14:07:23.731399Z

Hi @tkjone, thanks for your quick reply! 🙇 > The issue (as far as I understand): > • chrome is run and immediately exits unfortunately not on my machine: Chrome (headless) never terminates... > • figwheel-main doesn’t know chrome isn’t running and just keeps going (because it never receives a success/error msg) ... and that's why figwheel-main is quiet happy and exits w/ :figwheel.main.testing/success as expected. But chrome does not terminate.

athomasoriginal 2023-08-07T14:10:27.001779Z

Interesting! That is for sure the flip of what I experienced.

athomasoriginal 2023-08-07T14:10:58.853669Z

So, your tests run and complete, but then the process just doesn't terminate, yes?

RAMart 2023-08-07T14:18:14.319949Z

Right. You can even put figwheel-main completely aside:

/Applications/Google\  Chrome --headless=new --disable-gpu --no-sandbox 
Does not terminate. Using just --headless (without new) it does terminate as expected. Adding --repl – like in the good ol' days 🙂 – has no effect. (Same is true for adding --remote-debugging-port=9222.)

RAMart 2023-08-07T14:21:36.490539Z

I just can't believe that I'm the only one facing this. 🤔

athomasoriginal 2023-08-07T14:22:48.749689Z

For fun (to get to a minimal scenario) • can you remove --disable-gpu and --no-sandbox ? Test the above.

athomasoriginal 2023-08-07T14:24:28.396619Z

After the above, can you confirm if you're running a GUI instance of chrome at the same time as you're running your tests?

athomasoriginal 2023-08-07T14:24:47.669889Z

Additionally, what does your environment-log (provided by figwheel) say (if anything)

RAMart 2023-08-07T14:24:52.368399Z

Sure. Juggled with these the whole day... just a sec...

👍 1
RAMart 2023-08-07T14:43:53.560829Z

First of all: Thanks for your time and help! I owe you a beer. 🍻 > • can you remove --disable-gpu and --no-sandbox ? Removed. > can you confirm if you're running a GUI instance of chrome at the same time as you're running your tests? ps aux | grep -i chrome No chrome at all before running the tests. > Additionally, what does your environment-log (provided by figwheel) say (if anything) With the --remote-debugging-port=9222 set:

DevTools listening on 
Without:
[0807/163430.854680:ERROR:(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.
And no Tests were executed. (That's why I've added --disable-gpu in the first place.) (Adding / removing --repl has no effect to the results above btw.)

athomasoriginal 2023-08-07T14:46:31.528059Z

> And no Tests where executed. (That's why I've added --disable-gpu in the first place.) True, this seemed to happen with --headless=new

athomasoriginal 2023-08-07T14:59:43.968229Z

Do you have async tests? I'm trying to think if there is something in chrome that makes it want to keep runnning because normally it just exits lol

RAMart 2023-08-07T15:08:46.558729Z

> Do you have async tests? I have. (And I do use run-tests-async.) > I'm trying to think if there is something in chrome that makes it want to keep runnning because normally it just exits lol Do you run macOS as well? Running --headless=new on a static and simple index.html with no JavaScript at all does not terminate.

athomasoriginal 2023-08-07T15:10:14.235179Z

> Do you run macOS as well? yes

athomasoriginal 2023-08-07T15:11:20.489139Z

> Running --headless=new on a static and simple index.html with no JavaScript at all does not terminate. huh. I wonder what changed with "new". I started digging into the source and then bailed.

RAMart 2023-08-07T20:00:14.113149Z

ℹ️ Chromium https://bugs.chromium.org/p/chromium/issues/detail?id=1424852: repl stopped working

👍 1
Loic 2023-10-26T08:24:52.839809Z

@tkjone I just find out about this thread and your solution solved the issue for my chrome headless CI tests for both mac and linux: https://github.com/skydread1/flybot.sg/pull/264 So thank you! @ramart my terminal was hanging also for chrome headless tests so maybe my https://github.com/skydread1/flybot.sg/blob/master/tests.cljs.edn can be of any help, hope you already found a solution though!

🎉 1
RAMart 2023-08-08T18:12:44.741259Z

Aaaand we got an „it‘s by design“ together with a WontFix. (https://bugs.chromium.org/p/chromium/issues/detail?id=1418651)

athomasoriginal 2023-08-08T20:40:08.750789Z

That's sad, but it sounds like that ticket was about chrome immediately exiting. Wasn't your issue that chrome doesn't exit?