Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome PWA hangs #204

Closed
ghost opened this issue Aug 8, 2019 · 39 comments
Closed

Chrome PWA hangs #204

ghost opened this issue Aug 8, 2019 · 39 comments
Labels
bug Something isn't working can't fix Issues are unsolvable external Code outside our control

Comments

@ghost
Copy link

ghost commented Aug 8, 2019

Steps to Reproduce

  1. Install some PWA in Google Chrome (e.g. Twitter, Unsplash)
  2. Open a PWA installed the step below

Expected Behavior

PWA opens.

Actual Behavior

Google Chrome hangs.

@dominiklohmann
Copy link
Collaborator

dominiklohmann commented Aug 8, 2019

I can confirm this issue. When yabai is not running, Chrome spawns a dialog window with properties as shown in the screenshot. With yabai running, the window never gets shown and Chrome hangs completely.

The dialog window shows its actions on the touch bar as well, but nothing happens if you press either of the touch bar buttons.

image

Note that as a workaround, you can always set the space to floating mode and install the PWA, then set it back to bsp mode.

@sei40kr
Copy link

sei40kr commented Aug 9, 2019

@dominiklohmann
In my case, I could install PWA, but it hangs when opened while yabai running.

@koekeishiya koekeishiya added the bug Something isn't working label Sep 3, 2019
@zenobht
Copy link

zenobht commented Sep 25, 2019

Closed #263 we can track it here.

Pasted from #263
I use google calendar and there is no mac app for google calendar. But chrome provides a way to create your own chrome apps. Open calendar in browser, go to More Tools and create shortcut. Give a name and select open as window. Now you can open the calendar app you just created.

When yabai is running opening chrome apps hangs chrome.
yabai-chromeapp.log

Stopping yabai service and opening the same chrome app works perfectly.

yabai: v2.0.1 (sa installed)
OS: 64bit Mac OS X 10.14.6
Chrome: Version 77.0.3865.90 (Official Build) (64-bit)

@pardom
Copy link

pardom commented Oct 3, 2019

I'm also experiencing this problem and was seeing it with chunkwm as well. It wasn't apparent that yabai/chunk were causing the bug until I found this issue.

@koekeishiya koekeishiya added the help wanted Community help appreciated label Mar 1, 2020
@punitsoni
Copy link

I also see this issue on macOS catalina. I see that I can install a shortcut to chrome app but when trying to start an app, all chrome processes just hang and entire system goes very sluggish. Even getting to "force-stop" menu is painful at this time.

I use chrome apps extensively in my workflow. Has anyone found a workaround for this issue?
Is it possible to open chrome in "app-like" mode with minimal window decorations?

@koekeishiya
Copy link
Owner

So I decided to take a look at this so I install some pwa and observe Chrome crashes. Then I stop yabai and launch it just to get try and get a clue about what is happening, and the first thing I see after launching the pwa is:
Screenshot 2020-04-15 at 11 38 13

aand I think that was it for me.

@koekeishiya
Copy link
Owner

koekeishiya commented Apr 27, 2020

Looked a bit at this again and from what I can see there is nothing wrong in yabai. We receive and process the application launched events etc. properly. This is a bug that Chrome developers will have to look at. Good luck with that..

@koekeishiya koekeishiya added can't fix Issues are unsolvable and removed bug Something isn't working labels Apr 27, 2020
@punitsoni
Copy link

For me, if I stop yabai, the crop PWAs work properly as expected. However, when yabai is active they just get stuck. I tried this with multiple apps with different developers. All have same behavior.

@koekeishiya
Copy link
Owner

This is an issue within Chrome that the developers will have to fix. There is nothing I can do about this from yabai's pov.

@palashkaria
Copy link

@koekeishiya any idea if this issue was raised in the Chrome/chromium bug tracker?

There's similar stuff happening with Microsoft Edge for Yabai, & with Brave Browser for other WMs like amethyst (see this: brave/brave-browser#9006 (comment))

The odd thing is - Brave PWAs work fine with Yabai, Edge PWAs don't. On the other hand, Amethyst crashes Brave PWAs & works fine with Edge. Quite odd..

@koekeishiya
Copy link
Owner

koekeishiya commented Aug 12, 2020

I don't have the patience at this time to try and deal with these types of issues anymore, but here is an outline of what yabai is doing that seemingly causes the PWA to Crash:

  1. yabai is, at all times, monitoring the launch of processes on the system.
  2. We detect that a PWA/Chrome instance is launched, and observe for changes to the process' activation policy and launch status.
  3. After validating the state of the process using the above fields, we decide that this is an application that we should track/manage, and call the following function to retrieve a handle: AXUIElementCreateApplication(..)
  4. If successful, try to retrieve a list of the currently active windows using the standard AXUIElementCopyAttribute() function, and subscribe to events like window moved, destroyed etc.
  5. We never get here because the PWA hangs in either of the above calls for whatever reason. I assume they are thread-related issues and the PWA application simply gets deadlocked. I can't tell for sure, because the sampling output above is literally unreadable due to the PWA infrastructure.

@punitsoni
Copy link

One thing I noticed recently. If chrome is completely closed and the first thing you open is a PWA (from applications menu shortcut). It works. After this you can open regular chrome window and it does not crash.

So, the problem is only in case of starting a PWA while another chrome window is present.

@punitsoni
Copy link

punitsoni commented Aug 12, 2020

Is it possible to keep this issue open? Even if you cannot fix this right now, if it is open, someone can attempt to fix it as it will be visible as a pending issue.

@koekeishiya
Copy link
Owner

Sure, I'll re-open it for visibility purposes as you mentioned, but I am a 100% certain that this is an issue outside of our control and at the end of the day the Chromium devs is going to have to be the ones to resolve this issue. See my previous comment for how to reproduce the issues from literally any software that uses the macOS accessibility APIs.

@koekeishiya koekeishiya reopened this Aug 12, 2020
@koekeishiya koekeishiya added bug Something isn't working external Code outside our control and removed help wanted Community help appreciated labels Aug 12, 2020
@punitsoni
Copy link

See my previous comment for how to reproduce the issues from literally any software that uses the macOS accessibility APIs.

I could not find this comment. If it is possible to reproduce this issue outside Chrome, then it cannot be fixed by chrome developers right?

@brightpuddle
Copy link

@dominiklohmann
Do you know if there's a way to ignore PWA windows early enough in the recognition process to prevent this? For example, maybe a rule or service that prevents firing off the window recognition functions that are triggering the hang?

I've tried experimenting with rules and services, but not familiar enough with the Objective C or how these functions work to know what I don't know.

@h4wwk3ye
Copy link

Hi, now brave has also changed the way pwa behave like other chromium browsers (brave/brave-browser#7205). Is there a way to make pwa work with yabai. I tried [https://github.com/filips123/FirefoxPWA] but it was too much of a hassle.

@reinaldo-calderon-team
Copy link

I have the same issue, it happens in all chromium-based browsers, Vivaldi, edge, brave, opera ...

@andryandrew
Copy link

I second this, it seems other similar extensions (AltTab, BetterSnapTool) now work with chromium-based PWAs, while yabai doesn't on my machine

@reinaldo-calderon-team
Copy link

@dominiklohmann Other similar applications to Yabai are finding a way to fix this, do you have considered work on this?

@koekeishiya
Copy link
Owner

This does not look particularly fixed in Chrome if you ask me.

Chrome is seemingly looping forever, allocating more and more memory, for whatever reason.
These screenshots are taken within a ~35 seconds time interval.

Screenshot 2021-10-19 at 15 17 16

Screenshot 2021-10-19 at 15 17 52

Screenshot 2021-10-19 at 15 19 18

Sample of Google Chrome.txt

As I mentioned previously in this issue; I don't have the patience at this time to try and deal with these types of issues anymore, but here is an outline of what yabai is doing that seemingly causes the PWA to Crash:

  1. yabai is, at all times, monitoring the launch of processes on the system.
  2. We detect that a PWA/Chrome instance is launched, and observe for changes to the process' activation policy and launch status.
  3. After validating the state of the process using the above fields, we decide that this is an application that we should track/manage, and call the following function to retrieve a handle: AXUIElementCreateApplication(..)
  4. If successful, try to retrieve a list of the currently active windows using the standard AXUIElementCopyAttribute() function, and subscribe to events like window moved, destroyed etc.
  5. We never get here because the PWA hangs in either of the above calls for whatever reason. I assume they are thread-related issues and the PWA application simply gets deadlocked. I can't tell for sure, because the sampling output above is literally unreadable due to the PWA infrastructure.

If this is a big deal for you, feel free to debug yourself. Build a debug binary using make clean && make and break at this line.

@vramdal
Copy link

vramdal commented Oct 20, 2021

FWIW, this has been reported against Chromium as https://bugs.chromium.org/p/chromium/issues/detail?id=1129837

@tekacs
Copy link

tekacs commented Oct 24, 2021

@vramdal upon clicking the link that you've posted, I see "Permission denied." and can't see the issue by searching for it.

As of a few days ago, I started to experience this issue with normal use of the Vivaldi browser, eliminated simply (as with other instances here) by shutting down yabai -- marking Vivaldi as manage=off (and observing it being unmanaged) doesn't help -- perhaps because yabai calls the accessibility API initially to determine whether it should manage the window and it can't handle that?

Not trying to resurrect this issue for yabai to solve, just flagging here in case anyone else runs into this issue -- would also love to track this on the Chrome side.

@jtuckerk
Copy link

jtuckerk commented Oct 31, 2021

In the meantime I've found Chromeless it seems to require a separate login for every app which is slightly annoying, but otherwise it accomplishes the same thing as chrome apps and works with yabai! I havent tried creating custom apps yet, but it looks straight forward.

ps @koekeishiya thank you this is wonderful!

edit: after using chromeless for a week, its not that great of a workaround. the apps dont always open from the dock and I have to go into the chromeless app to get them to open. Also opening links from gmail always open in a new chrome window, and it seems to be impossible to merge the tabs with an existing chrome window

@NylonDiamond
Copy link

www.sodastream.com is another site that will cause a crash :)

@oneself
Copy link

oneself commented Mar 3, 2022

I can't say that I completely understand the idea that Chrome needs to fix this issue. Chrome is used by billions of users worldwide and works fine (mostly). When Yabai runs, Chrome crashes; when Yabai isn't running, Chrome doesn't crash. Regardless of who's technically at fault, it seems clear that Yabai needs to change to make Chrome work, not the other way around. I love using Yabai, and I have to use Chrome, and given Chrome's popularity, I imagine that I am not alone.

@koekeishiya
Copy link
Owner

koekeishiya commented Mar 3, 2022

Chrome is used by billions of users worldwide and works fine (mostly). When Yabai runs, Chrome crashes; when Yabai isn't running, Chrome doesn't crash. Regardless of who's technically at fault, it seems clear that Yabai needs to change to make Chrome work, not the other way around.

Generally I agree with this statement. Unfortunately we live in the real world with real constraints; I can't turn water into wine.
Neither Chrome nor macOS gives me the information that I need to be able to disambiguate between PWA's and a normal browser instance from what I have discovered so far, and the crash is happening inside the PWA infrastructure.

Lets not forget that one piece of software here is written and maintained by 1 guy in his spare time as a hobby, while the other is a professional piece of software used by millions of people, supported by one of the largest and richest tech companies in history.

I have outlined steps to reproduce the issue and where to begin tracing/debugging in my comment above, for those that are interested in looking at the issue. I have wasted countless hours on this and it is not worth more of my time. Feel free to prove me wrong if you'd like.

@dev-msp
Copy link

dev-msp commented Mar 12, 2022

The Chrome bug report is now visible again (asked a friend for a hand). By default, crash reports are hidden since logs can contain sensitive info.

Also uploaded a sample there since the one linked in this thread won't currently load for me.

@rsynnest
Copy link

Just to add another datapoint, for me Chrome was hanging 4-5 times/day while running Yabai, without any Chrome Apps/PWAs installed. I do have some Chrome extensions installed (SurfingKeys, 1Password), but not much. After turning off Yabai Chrome has not hanged a single time in the past 2 weeks.

This bug affected many previous versions, but my current affected versions are:

MacOS 11.6.2
Yabai 3.3.10 HEAD
Chrome 99.0.4844.51

@ianks
Copy link

ianks commented Mar 16, 2022

Just to add another datapoint, for me Chrome was hanging 4-5 times/day while running Yabai, without any Chrome Apps/PWAs installed. I do have some Chrome extensions installed (SurfingKeys, 1Password), but not much. After turning off Yabai Chrome has not hanged a single time in the past 2 weeks.

This bug affected many previous versions, but my current affected versions are:

MacOS 11.6.2
Yabai 3.3.10 HEAD
Chrome 99.0.4844.51

Same, no chrome apps but have 1password.

@emptyflask
Copy link

Interestingly, I'm not seeing this crash anymore, using:

MacOS 12.2.1 (M1)
Yabai 4.0.0
Chrome 99.0.4844.83

When I last tested with Chrome 98.0.4758.109 (everything else the same), that sodastream website would crash the browser. I haven't used it extensively yet, though.

@brightpuddle
Copy link

@emptyflask

I'm on 12.3 (Intel), Yabai 4.0.0, and 99.0.4844.83, and the issue is still present. You had me excited for a moment.

You'd have to open it as a PWA, i.e. going to PWA-enabled website within Chrome won't trigger the issue. Go to Google Maps and the PWA icon will appear in the location bar, or choose Open in Google Maps from the menu.

If it turns out that it really did suddenly resolve for you, it would be really great to understand more about your conditions. I've been waffling between the otherwise perfection of yabai and other, lesser solutions for years because of this one issue.

@dev-msp
Copy link

dev-msp commented Apr 22, 2022

Per the Chromium issue that's tracking the overarching bug, there is a fix for this in the latest canary release.

@brightpuddle
Copy link

I just tested the Canary 103.0.5019.0 release with the YouTube Music and Google Photos PWAs and no issues.

Now we either run Canary or just wait until it trickles down into a normal release.

@jtuckerk
Copy link

Can confirm! The canary release no longer hangs when using chrome apps and yabai

@vramdal
Copy link

vramdal commented Jul 13, 2022

It seems the fix has made its way into Chrome's Stable channel, so this issue can be closed.

@farzadmf
Copy link

Unfortunately, I still have the problem with what I call "Javascript-heavy" Websites (Chrome version 103.0.5060.114)

@teelahti
Copy link

I can confirm this is now fixed for me after the latest Chrome update.

@tijmenvangulik
Copy link

I still have this problem in Version 118.0.5993.88 (Official Build) (arm64) . It hangs when ever I update my website https://ergometer-space.org/. Brave and edge running on the same machine do not have this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working can't fix Issues are unsolvable external Code outside our control
Projects
None yet
Development

No branches or pull requests