Org-roam stopped working on MS Windows following Melpa Update

I updated my MELPA packages two days ago, and org-roam stopped working since then.

Specifically, M-x org-roam-mode lags indefinitely, and I have to stop it with C-g.

org-roam-find-file is then unable to find any of my files.

I tried to debug on my own (trying to learn to use edebug and so), and I get the impression that the lag happens inside function org-roam-db-build-cache, at the beginning of the call to emacsql-with-transaction.

I don’t know how to proceed from here… If anyone has ideas. Maybe I should try and switch back to an older version of org-roam-mode in the meantime?

Perhaps your issue is related to which version you upgraded from.

I just upgraded from a version of MELPA as of August 1 (20200801.xxx) to the latest as at the time of writing this: org-roam-20200816.1151 and I have no issue.

I can add a new note, and have a backlink to an existing note. See the image below. This is visiting an existing note entitled “Introduction”. The note entitled “new” shown in the backlinks pane is the one I just created after the upgrade.

If my assumption is right (“related to which version you upgraded from”), you might be coming from an older version. If so… deleting org-roam.db in Windows Explorer, and then re-building your DB might solve the problem. I’d take a backup copy of the current org-roam.db, just in case (I do this almost every time I have an issue with the database with Org-roam).

I’m also guessing the number of notes you have is less than 1,000. In my benchmarking with using my PC, the process of building db cache might take what you might think to be too long (without responses from Emacs) – 4–25 minutes or more if you have 1,000 in some cases (I can’t really go back to the analysis I did for this now, but just so that you know). My observation is that it’s mostly linear with respect to the number of notes – so if you have 100 notes, it would be about 1/10 of that duration.

I think this is different to the issue you describe and experience, but you might need a little patience on Windows – Linux does not seem to suffer from the same level of performance issue for some reason.

Incredible, you were right! I only have 74 notes in org-roam, and yet, although my (work) computer is quite powerful, it took it ten full minutes to cache them in the database. I had no idea the process was soooo much time-consuming, and the minibuffer was not helping, either: instead of telling me “Re-building the cache, please wait” (or, even better, telling me how many files had been cached up to now on the total number of files, displaying a percentage for instance), it was stuck at “org-roam-mode”. So after two minutes I invariably stopped it, thinking something was broken.

From the code I read, I got the impression that org-roam-db-build-cache opens each file successively in a buffer, parses them to find all the links and titles, and puts that information into the database. That may be why it takes so long. Yet there must be something which makes it a lot longer on Windows.

So your suggestion was right: delete org-roam.db, reload Emacs, launch org-roam-mode, and have a one-hour coffee break. Thank youuuuu! :partying_face:

1 Like