-
Notifications
You must be signed in to change notification settings - Fork 218
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
Userscripts extension stops working after a while of Safari uptime until Safari is quit and restarted #245
Comments
Thanks for reporting this. I have some follow up questions/comments:
Are you referring to the macOS 12.3.1 update? or an update to the userscripts app?
There are some other places to look, if you don't mind. I will list them below. Extension popupIf you right click anywhere in the extension popup, you should get a tooltip that offer the option called Extension popup errors do not get logged in the "normal" browser console. Background pageThe background page is where a lot of the app logic lives. When errors occur here, they also do not log in the "normal" browser console, but you can view the browser tools for this background page by navigating to the Safari option You might notice that the background page for this app might be labeled as That being said, when you click on the option for Console.appThe last place to check for errors is If I had to guess, I would say that the extension (for some reason) stopped responding to events, which drives the logic throughout the different parts of the app. As mentioned above, this extension is event-driven and the background and popup page simply listen for various events and respond accordingly. At one point I did encounter an issue while working locally where the extension stopped responding to events, for no discernible reason. From what I saw, it simply stopped responding to events. Unfortunately I could not reproduce the issue and it spontaneously stopped presenting itself; I can not recall if that was before or after the most recent macOS update. My gut tells me this could be an upstream issue with Safari, since the event logic is fairly standard. If you encounter this again and are up to doing some bug checking using the methods above I would really appreciate it. Also, if you figure out a way to reliably reproduce the issue please let me know. |
Sorry, that wasn't clear -- I'm referring to the latest macOS 12.3.1 update, that seems to coincide with when I started noticing this issue with Userscripts. Unfortunately, nothing seems to be coming up in the developer console in either of the first two methods you listed. Opening the Console.app and filtering for any Userscripts related logs does have some results though, here are some screenshots of that. Not entirely sure what's normal and what isn't so I've included everything I could find! Can't seem to figure out a way to reproduce it reliably other than just having Safari open for half a day or so. I'll mess around with the scripts I have installed to see if it's a certain one potentially acting up. |
@v7rzlhb3xg thank you for looking into this
I am surprised nothing was logged there. That makes me think what you are experiencing is different than what I experienced and that my theory as to what was going on is incorrect.
Most of those are spurious "errors". They've existed since the inception of the extension and Apple has said they can safely be ignored. However that first error, about the CPU usage, I have never seen before. When looking at my own console, I do see similar message for other apps (image below). I'm not sure if that's indicating an issue, but seeing that 100% cpu is being used by the extension for that long doesn't feel right, even if it is not the cause of the issue at hand.
When you have Safari open, does your macbook remain open as well or are you closing the lid/sleeping the machine and just continuing your session? For me, I tend to keep quite long safari sessions, but I do sleep the my macbook when not being used (by closing the lid). I am curious if there's a way I could try to repro the bug on my machine as well. Also, if you don't mind, could you share what hardware macbook version youre using? |
I have the same problem where I open my MacBook Pro (M1 Pro 2021) and notice that the Userscripts extension is using 100% CPU, as if it were stuck in an infinite loop. Disabling and re-enabling the extension gets it working fine again, but it regularly returns to this state after the laptop is closed and opened again. I also first noticed this about a month ago, so it may be macOS 12.3.1 related. |
The issue I was having has seemingly resolved itself between upgrading to macOS Monterey 12.4, doing a full clean and fresh reinstall of Userscripts from the App Store, and then reinstalling the beta version. Not sure what exactly fixed it! |
Is it possible for you to provide a screenshot of the console and any diagnostic or bug reports from I am not sure what this could be, whether or not there is an issue with our code or something with macos or safari. |
Ah, I was going to check if 12.4 was out, but I forgot... I will install that and see if the issue goes away. @quoid here's a paste of the console log:
|
I hadn't realised macOS generates diagnostic reports for high CPU usage processes. Why has nobody ever written an app to notifier the user whenever such a report is created? Would save my battery on a few occasions - I keep the activity monitor CPU usage in the dock, but don't always spot these runaway processes. Anyway, looking further through the logs I see reports from 28th April (14:13), 12th May (11:25), 19th May (11:45), 21st May (15:48). That's probably a reasonable representation of when it began, and how often it occurs. |
Thank you very much @zexpe It looks like you're on version 4.1.0 (app store version) and not beta, can you confirm for how long you've been using this extension? The reason I ask is that the reports started 28 of April and I am curious if this coincided with a macOS update to (to 12.3 or 12.3.1) or this has been happening since you've been using the extension.
I was also unaware of that until this issue. I am not sure how long they persist for as some that I saw and put in the screenshots above have seemingly disappeared :/ If they are auto-purged then I reckon it's possible there were previous reports before the 28th of April on your machine. |
Also would you be willing to send me one of the diagnostic reports? (right click |
I've been using the extension since I got this laptop late last year, and 28th April was when I first saw this problem. So presumably sometime after the update to 12.3.1. My reports go back to 30th March, but I doubt the problem occurred before 28th April - I would have noticed it from the CPU usage in the Activity Monitor app dock icon. BTW, I've turned on a "Folder Action" to monitor new reports being added to the /Library/Logs/DiagnosticReports folder. It seems to work quite well. UserScripts hit 100% CPU again this evening whilst I was using a different app to Safari on my laptop, without any sleep/wake cycles. I'll e-mail the report to you. Haven't updated macOS yet... |
Just happened again on macOS 12.4 now.
|
I haven't yet updated to 12.4, but I am using that folder action you made as well. I haven't yet gotten alerted about Userscripts, but I have for other apps (although their average so far is ~70%). I was thinking maybe this could be due to hardware limitations, such as older machines, but we have the same model (2021 M1 Pro). |
For what it's worth, I've not seen a recurrence of this issue since updating to Userscripts 4.2.0. It's been over a week now without this happening. |
@zexpe thanks for the update, I have not seen it since setting up the alerts, but I have been on the beta 4.2.0 before I set that up I'll close this issue, but if it re-appears, feel free to re-open, thanks again |
Same or at least similar issue has started happening again for me for the past couple weeks. macOS Ventura 13.3.1, Safari 16.4, Userscripts 4.4.1. Scripts seem to stop working after an extended period of Safari uptime, requiring me to either restart Safari or manually load the extension through Menubar > Develop > Web Extension Background Content > Userscripts (not loaded). Can't seem to find any error logs since the extension doesn't load in the first place. |
Thanks for the report @v7rzlhb3xg. I am not sure what we can do here without logs 🤔 I just recently upgraded to 13.3.1, so I will personally see if I become affected by this. |
@quoid Here's two logs I managed to get when Safari crashed after attempting to manually load the extension through the Web Extension Background Content menu, not sure how useful they are but hope they offer some insight! Safari Crash Report 2023-05-11 21.38.58.txt |
Thanks for the logs @v7rzlhb3xg. I didn't see anything glaring in there that would indicate an issue, but then again, I am not great at parsing logs from macOS. Would you mind backing up all of your scripts and taking note of your settings and trashing the extension folders in I am not sure if this would help, but that's something I would try. Again, only if your comfortable doing this and make sure to backup your script files. |
@v7rzlhb3xg Hi, when you see "Userscripts (not loaded)", it's normal, background script are automatically unloaded after some time of inactivity, this is how non-persistent background works. Normally, when you open the If you are able to open the I don't think this extension is causing your safari to crash, if your safari crashes and quits automatically, i think it's probably something else. Anyway, try to follow the instructions above to get a valid log, that will help everyone understand where the issues are. @quoid , using an absolute path is probably the more accurate way. Press ### Userscripts-Mac-App
~/Library/Containers/com.userscripts.macos/
### Userscripts-Mac-Safari-Extension
~/Library/Containers/com.userscripts.macos.Userscripts-Extension/
### App and Extension Group Container (Shared)
~/Library/Group Containers/J74Q8V8V8N.com.userscripts.macos/ If you haven't changed the ~/Library/Containers/com.userscripts.macos.Userscripts-Extension/Data/Documents/scripts/ |
Hey, I think I noticed this begin to happen with the latest macOS update. After a while of having Safari open I'll notice that Userscripts just stops working -- no scripts are being injected and the developer console doesn't show any Userscripts activity either. Clicking on the Userscripts extension icon in my Safari toolbar also just gives me the endless spinning loading circle. The only thing that seems to fix it is restarting Safari again. I've experienced this on both the App Store release version as well as the latest TestFlight beta version. Let me know if there's any more information I can provide.
System Information:
The text was updated successfully, but these errors were encountered: