obsidian-tasks icon indicating copy to clipboard operation
obsidian-tasks copied to clipboard

Freezes after plugin launch

Open Fertion opened this issue 3 years ago • 31 comments

After launching the plugin, the file manager freezes for about 10 seconds. When you click on any note, it is highlighted as selected (at the same time, the highlight from the previously selected note does not disappear). But the note itself does not open. After a while, the problem disappears and the note opens.

I turned off all the plugins one by one and I definitely see that the problem is in tasks. Even if you run it separately, the problem will appear.

Expected Behavior

after the plugin is launched, there should be no delay in opening notes

Current Behavior

after launching the plugin, when trying to open a note, it hangs for a short period of time

Steps to Reproduce

I start obsidian. I enable the plugin. I'm trying to open a note.

Context (Environment)

  • Obsidian version: 1.2.0 (50)
  • Tasks version: 1.5.0
  • [x] I have tried it with all other plugins disabled and the error still occurs

Fertion avatar Apr 17 '22 00:04 Fertion

@Fertion Thanks for the report.

Can you give an indication of the size of your vault? Roughly how many Markdown files and roughly how many tasks?

Also, what core plugins do you have enabled?

Than you.

claremacrae avatar Apr 17 '22 04:04 claremacrae

4009 notes. 4422 attachments. 934 megabytes. 842 tasks.

Core plagins: File explorer Search Graph view Backlinks Outgoing links Tag pane Page preview Daily notes Command palete Slash commands Editor status Starred Outline Word Count Audio recorder Open in default app File Recovery

If I disable them all, the problem remains.

Fertion avatar Apr 17 '22 06:04 Fertion

Thank you for the report, @Fertion! This is super strange, as the Tasks plugin does not do anything when you open a note (or click in the file tree).

Would you be willing and able to install a "debug" version of the Tasks plugin and send us the console output? It would be another main.js file that you would need to move to VAULT/.obsidian/plugins/obsidian-tasks-plugin. From your Obsidian version, it seems you are on mobile. I am not sure how easy it would be to move a special file into the vault inside the .obsidian/plugins/ folder.

schemar avatar Apr 18 '22 11:04 schemar

Where can I find the debug version? How can i send the console output?

The problem is both on the PC and on the android (on the smartphone it's just more pronounced).

Fertion avatar Apr 18 '22 17:04 Fertion

I would need to create it specifically for you and send it to you.

schemar avatar Apr 18 '22 17:04 schemar

Ok, I'll wait, then I'll do everything that needs to be done.

Fertion avatar Apr 18 '22 18:04 Fertion

Does this happen on your PC as well? Can you please try re-downloading the latest version of Obsidian there and confirm that you still have this issue? It might be a while until I can create a debug build. Thank you!

schemar avatar Apr 18 '22 18:04 schemar

Just want to add: it seems that other users including myself (see also #153) are experiencing this issue (and as said by @Fertion, it's more pronounced on the mobile app as it is more frequently reloaded than the desktop app, at least that's my experience on iOS).

I noticed that Tasks was causing the freezing when I turned on the 'Debug startup time' and saw that the Tasks plugin took the longest to initialize, and after disabling it the issue was gone. Admittedly my vault is also quite big, though not as much as @Fertion's

AngelusDomini avatar Apr 19 '22 06:04 AngelusDomini

Does this happen on your PC as well? Can you please try re-downloading the latest version of Obsidian there and confirm that you still have this issue? It might be a while until I can create a debug build. Thank you!

Reinstalled, the problem is still the same.

Tested turned on/off the 'Debug startup time'. I don't see the difference.

Fertion avatar Apr 20 '22 16:04 Fertion

Tested turned on/off the 'Debug startup time'. I don't see the difference.

'Debug startup time' is merely to show how long in milliseconds your plugins take to initialize/start up; it shouldn't affect performance. Obsidian shows a notice at startup how long your plugins took to run; reopen/refresh Obsidian and maybe you'll see what I mean.

AngelusDomini avatar Apr 21 '22 08:04 AngelusDomini

@AngelusDomini

I'm sorry, my English is bad, so I misunderstood the phrase "Tasks was causing the freezing when I turned on the 'Debug startup time"." :)

There’s also the fact that nominally the plugin loads instantly, but in fact, opening notes hangs for about 10 seconds if I turn on this plugin.

image

Fertion avatar Apr 21 '22 20:04 Fertion

@Fertion Oh that's interesting, your plugins actually load pretty fast compared to the plugins on my phone (which is admittedly quite old and slow now—Tasks takes about 200+ms to initialize on good days), so i guess this means that the startup time of plugins—and more specifically the Tasks plugin—varies between devices, and is therefore irrelevant in this case perhaps.

Nevertheless, the issue about the plugin freezing the file explorer and notes at startup still remains, as you said.

AngelusDomini avatar Apr 22 '22 09:04 AngelusDomini

I am struggling to understand how the Tasks plugin could freeze the file explorer. For me, as soon as I load a note that has tasks blocks that match hundreds of tasks, there's a noticeable pause on my iPhone before the task blocks render - which makes sense as it's doing a lot of work. But I would have thought that the File Explorer is completely independent of that. Just wanted to see if I'm missing something, @schemar

claremacrae avatar Apr 22 '22 09:04 claremacrae

That's how it goes:

https://user-images.githubusercontent.com/102726751/164685548-04b83433-515d-4136-9e48-ed8fb89c6816.mp4

Fertion avatar Apr 22 '22 10:04 Fertion

That's what happens with mine as well when opening from the file explorer. The same essentially happens when opening a note from the Quick Switcher, but it first opens an empty pane with the title "No File" for a number of seconds before it actually opens the note.

AngelusDomini avatar Apr 22 '22 10:04 AngelusDomini

OK, now I get it. I think? Tasks' initialization blocks some worker process in Obsidian, maybe. The easiest fix could be to iterate async so that other operations get put on the V8 stack in between parsing files or something :thinking:

schemar avatar Apr 22 '22 11:04 schemar

Same bug here. I tried upgrading the plugin & Obsidian to their latest versions (Tasks 1.8.1 and Obsidian Android 1.2.2), downgrading the plugin, disabling all other plugins - seems like nothing works and it messes with Obsidian itself fundamentally. This seems to happen both on mobile and on PC.

I rely heavily on Tasks and on instant input via QuickAdd and Advanced Mobile Toolbar, and have to restart the app a lot, so I was about to create this issue myself. It doesn't help that Quickadd also has a massive issue preventing its use after startup😅

alexlyzhov avatar Jun 26 '22 02:06 alexlyzhov

@alexlyzhov Thanks for the report.

what sort of size is your vault? Number of files? Number of tasks?

I haven’t been able to reproduce this, so would appreciate help tracking it down. Are you able to see the console on Android?

if so, I could add some debug output to try to see what is going on behind the scenes.

claremacrae avatar Jun 26 '22 05:06 claremacrae

@alexlyzhov an earlier comment specifically refers to freezing the explorer. Is yours exactly the sAme?

Is it possible for you to include a video of the problem in action for your device please?

claremacrae avatar Jun 26 '22 05:06 claremacrae

I’m also getting this issue. I open Obsidian and it goes to my home note. After tapping another note to open, nothing happens. I can tap more than one note in the file explorer and none will open for about ten seconds. When I disable the tasks plugin, there is no delay. I have a couple tasks with that #tasks hashtag and have written a query for them in just one note. How can I help debug this?

daxmonson avatar Jul 03 '22 18:07 daxmonson

I’m also getting this issue. I open Obsidian and it goes to my home note. After tapping another note to open, nothing happens. I can tap more than one note in the file explorer and none will open for about ten seconds. When I disable the tasks plugin, there is no delay. I have a couple tasks with that #tasks hashtag and have written a query for them in just one note. How can I help debug this?

Ideally by pairing with me, screen sharing, so we can explore what is going on, and I can add some debug output to find out more...

claremacrae avatar Jul 03 '22 18:07 claremacrae

Ideally by pairing with me, screen sharing, so we can explore what is going on, and I can add some debug output to find out more...

Communicating via GitHub is just too low bandwidth...

claremacrae avatar Jul 03 '22 18:07 claremacrae

I have identified some possible causes of this:

  1. When obsidian is opened, whilst Tasks is reading all files in the vault, to find all tasks, large numbers of console logging messages can be generated if there were already any notes open that:
    1. Have at least one tasks block in them
    2. Are in either Reading mode or Live Preview
    • The more tasks blocks are in Reading or Live Preview, the more messages will be logged
    • The more files that there are in the vault, the more messages will be logged
  2. I am not certain of this, but I think that if the vault contains large non-text files, they may contribute to Tasks' start-up time too.

It would be really helpful if anyone who has observed this problem could see if it makes a difference if you close any files with Tasks blocks in (including any in pinned in the side-panes) and re-start obsidian, and confirm whether that makes any difference?

claremacrae avatar Jul 18 '22 11:07 claremacrae

I made some improvements to the startup time of the plugin in Tasks 1.9.0.

If you have had this issue at startup, please could you try out the new release, and report here whether I can now close this issue?

Many thanks.

claremacrae avatar Jul 18 '22 22:07 claremacrae

Hi, I ended up using Apple reminders and using Obisidian URI in its url section for things I need reminders on. I reinstalled this to try and help out and seems there's still about a ten-second delay before I can select/access notes with it installed (ipadOS). In the middle of a big project so set a reminder to record a video for you when I get a sec.

daxmonson avatar Jul 18 '22 22:07 daxmonson

I do still have it: I tried 1.9.0 on mobile and there's still a period of about 5-6 seconds after loading Obsidian when notes do not open. I've checked this is due to Tasks because it disappears when I disable the plugin and restart. I'm using latest Obsidian on Android 12, OnePlus 10 Pro (2022) with Snapdragon 8 plus Gen 1 (2022) and 12 GB RAM.

alexlyzhov avatar Jul 18 '22 22:07 alexlyzhov

Hi. I have the same exact thing, nothing has changed after the update. What can I do to somehow gather logs and help?

Fertion avatar Jul 18 '22 22:07 Fertion

My guess is that a possible solution would be to add an exception setting that allows you to exclude certain folders from processing.

Fertion avatar Jul 20 '22 21:07 Fertion

That’s certainly a possibility. I also need to investigate whether it was a just parsing markdown files, or if it is looking at other file types.

On the desktop, I ran the latest insider installer yesterday, and the general speed up Obsidian is incredible, so that is also something worth trying.

Also, when the plugin is starting up, it re-displays the ‘initialising’ message on every tasks results view that is open, once per file with tasks in. (Before 1.9.0 it was once per file in the vault)

so there are lots of things to investigate.

I will just keep on speeding it up until it is fast enough.

claremacrae avatar Jul 20 '22 22:07 claremacrae

Re-opened.

claremacrae avatar Jul 20 '22 22:07 claremacrae