DevonThink freezes upon opening database [solved]

Is there enough disk space available on your startup volume? Did DEVONthink ever crash or freeze? To fix this you could try to restore an older backup. Afterwards please verify & repair the database - are any issues reported? I would also suggest to completely rebuild the database (see File menu).

BTW:
According to the sample AppleScript causes the freeze. Do any of your smart rules or reminders use a script?

Yes, several of my smart rules do use embedded apple scripts, although I did not change any of them recently.

To test whether this would solve the freezing, I tried setting all SmartRules to OnDemand before opening the database in question. Voilà, it now opens without an issue!!!

So it seems that the reason only this database caused the freezing is that the Smart Rules containing apple scripts all have just this database in scope. I believe that the database itself is fine, and will go on to verify this now. I’m confident that this is solved, since standard restoring and rebuilding has always been super reliable when I needed it in the past.

The mystery remains, why script-based Smart Rules that worked fine over the past months suddenly caused an issue. But I’m just really happy that everything is fine, and it seems pretty clear that this was not caused by an issue in DT as such.

A huge thank you goes to @cgrunenberg for your help! I never would have guessed it’s an issue with apple scripts I’m using in smart rules.

You’re welcome! And please let us know which script is causing the issue or, if possible, just post its source - thank you!

Will do!

I’ve been experimenting with scripts from across the forum, so most likely it’s not one of those that come with DevonThink.

Just to confirm: Problem solved, all data is intact (and was never in danger) :slight_smile:

I’m now trying to figure out, which smart rule script caused the issue (which is tough, since they’ve been working flawlessly for a while now).

One possible cause:
In an effort to simplify and consolidate, I had added two embedded scripts into one Smart Rule with the same scope a few days ago. Previously, these scripts were in two separate smart rules, with one script each. Combining them in one smart rule did seem to be working as intended, but I don’t really see anything else that could have been at the root of the issue.

Is it okay to do this in general?

Usually it shouldn’t cause any troubles. Which scripts did you merge, how does the result look like?

Just to clarify, I didn’t actually merge the scripts (not enough scripting knowledge), but rather I added a second “Execute Script” trigger in the same smart rule.

Screenshot 2021-07-26 at 20.13.00

It’s the “exclude from wiki linking” script from this thread, which I modified to exclude from tagging (embedded script 1) and from classification (embedded script 2).

The scripts do produce the intended effects and have always worked flawlessly when each had its own smart rule. After combining them, they did seem to work just as well as before.

Sometimes a script might behave differently with input it does not expect. Maybe they’re unhappy with one of the recently added records?

Here’s an example of “Sometimes people do things we wouldn’t expect.” :slight_smile:

@cgrunenberg I wanted to provide an update on this, in case it’s useful or it helps to identify a causal factor.

The issue has reoccured twice, each time after verification found missing files. However, I believe come closer to identifying the cause, and mitigated it for my specific setup.

Some observations:

  • After exporting and removing all AppleScript smart rules, the database opens normally and there’s no spinning wheel
  • If, with the database open, I then import two smart rules containing the same apple script (applied under different conditions), then I get the spinning wheel. However, this is only the case, if these smart rules are also set to run in intervals (Hourly, every minute, etc.)
  • If I set the smart rules containing the same AppleScript to “After Saving”, then I can import them with the database open and there is no spinning wheel.

My theory
It seems that DT runs interval-based smart rules immediately upon opening the database, and that if two smart rules contain the same script this causes the spinning wheel issue. But only after repairing a missing file error.

I believe that setting the Smart Rules to “after saving” will resolve the issue for my setup, since they will no longer be triggered at the same time after opening the database following a “Missing File” message and automatic repair, which seems to cause the issue.

Thank you for the info! Which script did you actually use, could you please post the source or a link? However, smart rules are never executed concurrently, only one after another. Therefore please choose Help > Report Bug while pressing the Alt modifier key and send the result to cgrunenberg - at - devon-technologies.com - thanks! Maybe the logs contain some additional hints.

This is the script used in the smart rules, which I believe to be somehow connected to the issue: Exclude from Wiki Linking not working as expected - #15 by pete31

As emphasized earlier, I doubt something is wrong with this script as such. Probably the cause is in how I’m applying it or something in my local setup. It has always worked as intended.

Unfortunately, I can’t send the logs since they contain file names and I’m not comfortable with that… Sorry.

But all good from my side. I’m hopeful that the issue won’t reoccur anymore based on the described settings change.

How many records are matched by the Smart Rule that uses the script?

The script is used in three smart rules in total. Two check the “Exclude from wiki links” checkbox and one unchecks it.

The records matched are: 14812, 16 and 941.

The source of the scripts would be useful, thanks.

Sure. I had added it to this post above: DevonThink freezes upon opening database [solved] - #16 by AW2307

Is it necessary to always process that many items? E.g. the smart rule could add/remove a tag (e.g. Excluded) too and this tag could then be used to reduce the number of smart rule results.

I was thinking the same thing when I entered that number :smiley:
Should be okay though, now that the trigger is set to “after saving”, right?
My understanding is that there would only be any processing when I make a change to an item.

This should usually process only one item as such rules are only triggered after saving modified documents.