DevonThink freezes upon opening database [solved]


I’ve encountered the occasional issue in the past, which was easily solvable by restoring my main database via TimeMachine, but this one has me a bit worried:

Today, upon opening said database, verification said there was one inconsistency. Upon clicking “repair”, the message said that repair has been successful.

However, at this point DT just froze completely (spinning wheel). There was neither a crash, nor did DT “unfreeze” and become operable again. Whenever I open this database, the same behavior reoccurs.

So I tried restoring a previous version of the database that I know worked flawlessly before and certainly was not corrupted when the backup was made. BUT: The issue persists with that version of the database as well!

The only thing that changed on my system is that I installed Adobe Acrobat Pro 2020 yesterday. There was actually a warning in DT, that the Adobe viewer plugin is incompatible, which I initially disregarded. I have now uninstalled Adobe Acrobat just in case, this did not help either. I have also rebooted several times.

Any troubleshooting suggestions are most welcome and appreciated.

Could you please launch Apple’s Activity Monitor application (see Applications > Utilities), select the frozen DEVONthink 3 the list of processes, choose the menu item View > Sample Process and send the result to cgrunenberg - at - Thanks in advance!

In addition, where in the filesystem are your databases actually located?

Hi @cgrunenberg,

thanks for your quick response. I have sent the sample via email as requested.

The databases are located on my Macbook’s internal drive under [Username]/Databases.

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).

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 - - 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