denolehov / obsidian-git Public
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
[Feature Request] Run on background process. / [Bug] UI freeze when run. #69
Comments
|
I'm having the same issue here! One thing that feels strange to me is that if I manually push the changes from within the command line using |
|
Same issue here! I've configured obsidian-git to push changes every 5 minutes, so the lagging / freezing becomes REALLY annoying. |
|
Same issue |
|
Can we rename this issue "Abnormally high CPU usage" or something similar. Same issue, but some more details. When Obsidian Git is running, the Obsidian process spikes to 90-100% CPU usage for ~30 seconds. Obsidian Git plugin settings also spikes the CPU. For example, I'm experiencing the following:
Same thing happens when I toggle off Obsidian Git under Community Plugins and toggle it on. UI freezes for 5 seconds before the toggle turns on. What OS are y'all running? I didn't notice this until after I upgraded from MacOS Catalina to Big Sur last week. Not sure if that's a coincidence. |
|
Actually, I think this issue was greatly improved after I upgraded my Obsidian and the plugin to the newest version. Maybe you can try to upgrade your Obsidian under the "Options -> About" tab. The plugin still frees my UI for ~5 seconds, but it's much faster than before (~30 sec). |
|
I have the same issue, and I experience it on both my Mac running Catalina and my Mac running Big Sur. I just noticed that Ben Hong had the same issue on his live stream a couple of days ago. You can see it, and he points it out, at the 32:30 mark here: https://www.twitch.tv/videos/1044660956?t=0h32m30s |
|
I updated the issue's name to reflect two side of this issue. |
|
I have the same issue on Big Sur. Freezes the UI until the commit runs for 10-15 seconds. Recently I've updated Mac OS High Sierra to Big Sure and thats when I noticed the issue straight after. |
|
same issue. and it's only on mac. on Windows 10 works fine, but on Mac freezing even I open setting page for plugin Freeze when I run from command panele "Commit all changes" and when I open plugin options for this plugin. When I open plugin options for other plugins it works fine |
|
Yeah this happens for me as well on macOS (Big Sur). On Windows 10 I have no issues. |
|
I am only on Linux and Windows and I think you are all macOS users right? It's hard to reproduce for me. I think the problem must be somewhere else. I don't know if running it in a different process is the right way and would even fix it. |
|
@Vinzent03 can I help you get some logs for diagnose problem? |
but it reproduce only for this plugin. |
Screen.Recording.2021-08-22.at.18.00.15.mov |
|
What common have launch settings page and commit? May be it relate with git library? On mac git require Xcode |
|
I think the root of the issue is either the communication of |
|
@Vinzent03 may be you can add some verbose logs for localize the problem, and I will run this and give this logs for you. Your plugin is very comfortable. It would be great continue use it on Mac. If we can find concrete method of lib, we can create an issue to lib's devs) |
|
When open plugin’s setting window: When run command “Pull from remote”: When run command: “Create backup" |
|
Sorry for late response. Seems like every communication with simpe-git/local git installation freezes Obsidian. I don't think I will have the time to put that in another process (if it works at all). Pull requests are welcome |
|
I would think the only way around this is to spawn another process - I wonder if that's even possible with the Obsidian plugin infrastructure. |
|
Some funny moment. |
|
Not sure it's been said already in this thread: the plugin did not have this behavior in the past, on MacOS. So either a change to Obsidian or a change to the plugin introduced this issue. Has that breaking change been tracked down? |
|
@dsteinbock Do you remember roughly how long ago it worked fine? Maybe try a past release around then and see if it persists? https://github.com/denolehov/obsidian-git/tags |
|
I've also been having this issue (Intel Mac, plugin version 1.11), for me the pause is 6-7sec so really uncomfortable in terms of blocking note-taking at important times. For the time being I've gone back to the background task of uploading to GitHub as described here: https://medium.com/analytics-vidhya/how-i-put-my-mind-under-version-control-24caea37b8a5 kudos to @Vinzent03 for an excellent plugin, hopefully someone with more skill than me can help him with a solution |
|
Confirming same issue here. Freeze is about 40-50 seconds so I've had to set the sync to 180 minutes just to make it tolerable. Preferably it would sync much sooner than that. macOS Big Sur 11.6, Obsidian v0.12.15, git version 2.32. This has been occurring for "a while" though I can't put my finger on specifically when it started becoming a problem. It's been at least a couple months I would think. I upgraded to Big Sur in May and to the current OS version last week, so those don't seem to be directly related. Obsidian is set to auto-update. Interesting to note that I currently have 3 instances of Obsidian open, each pointing to a separate vault, and they have been open for multiple days. I also have it set to pull before push and to show the status bar updates. I closed all of them, forced a restart of Obsidian, and tried changing a couple of settings.
After the second change, measuring the time from initiation of the commit to the time when the note screen is responsive again is 32 seconds. But when I immediately open the settings screen right after the popup message says the git operation is complete the UI still lags until nearly 45 seconds (total) before the settings UI is usable. Interestingly, the status bar says it is now 4 minutes since the last git update, and when I just reopened the settings screen it once again lagged for about 10 seconds before even displaying the screen. The Obsidian Helper (Renderer) process spiked the CPU as described by others. I did have the git plugin configured to run every 1 minute for the tests I described above so it appears there is some interaction happening here that is causing effects that persist beyond the execution of the plugin itself. When I switched the plugin back to 180 minute intervals and then terminated the entire Obsidian process and restarted it with a single vault, the expected smooth fluid operations returned, no noticeable lag in usage. |
Well the issue was first reported by @lkhphuc on April 21. I remember dealing with the lag for weeks — thinking it was an Obsidian bug that would get fixed — until I traced it to this plugin. So we should try testing old versions of Obsidian w/ old versions of obsidian-git to backtrace. e.g. Try to find a past version combo that doesn't exhibit this bug. Then work forward in time from there. other Obsidian releases: other obsidian-git releases: |
|
This happens to me as well. I've tried debugging this issue with Chrome DevTools. While the backup task is running there are multiple Googling directed me to issue in electron repo, that seems to be related to this issue. Other possibly related issues: From the above discussions it is apparent that the issue occurs in newer versions of MacOS Big Sur. Recap of the bug with a timeline: electron/electron#26143 (comment) My system:
|
|
Is there any news on this? I've increased the committing interval to 1h, but it would be nice to have a more fine grained history about my edits |
|
Not sure if it's related, I have/had the same issue, I did a simple When I then ran Related Link: https://www.jeffgeerling.com/comment/17150#comment-17150 My system:
|
|
My solution to this was to simply write a contab to run git every x number of minutes. I love the plugin but will have to wait until there is a fix. |
|
Today I was prototyping an idea that could partially solve this freezing issue and it seems it might work. I was thinking it would be great if the plugin did auto backups only when Obsidian window is in background (not focused). It can be implemented using Pseudo code: const backgroundBackupTimeout = 1000 * 60 * X; // X minutes
let timerId;
window.addEventListener('blur', () => {
timerId = setTimeout(() => {
// do backup
}, backgroundBackupTimeout);
});
window.addEventListener('focus', () => {
if (timerId) {
clearTimeout(timerId);
timerId = undefined;
}
}); |
|
Speaking only for myself I think this could be a great thing to try. I typically leave obsidian open most of the time and it is idle in the background most of that time so that would be a good UX experience for me. I'm assuming the option to display a notification when the plugin starts would still work, so if a user unblurs the app while it is executing they would see the notice explaining why it is temporarily sluggish? |
|
I would also really appreciate the background solution. In particular, I often open Obsidian in the middle of a meeting to quickly jot something down, and having it hang for the first ~5+ seconds is pretty annoying. @Vinzent03 would you be open to a PR that does something along the lines of what @miluoshi suggested? |
|
I've created a PR with suggested feature above #188 |
|
@miluoshi: Thanks a lot… I've just installed it manually in my Obsidian and will report back if there are any issues. |
Thank you! It definitely needs some testing, because I might have missed some edge cases. |
@tht thanks for testing. I'll get back to it this weekend. |
|
Notice that fix for the original bug with freezing in libuv was merged yesterday and we're waiting for Electron to merge this fix and release updated version: electron/electron#26143 (comment) |
|
After Electron merges this fix, will we have to wait on Obsidian to also update? Or will that fix in Electron propagate down to Obsidian? Sorry, I am not a programmer by trade. I've just been learning bits and pieces here and there because of Obsidian. |






I set git backup to run automatically every hour.
Everytime it runs, Obsidian becomes laggy and unresponsive until it finish, which can takes up to 30s-60s. If I happen to be using Obsidian at this exact time 2-3 times in a morning, it can be very frustrating.
I wonder if this process can be run in the background?
Maybe related if #68 is fixed.
The text was updated successfully, but these errors were encountered: