Skip to content

[BUG] QOwnNotes freezes during OneDrive synchronization #3847

Closed

Description

@skylord123

Expected behaviour

QOwnNotes should remain responsive while OneDrive synchronizes the notes folder. External file changes should continue to be detected and loaded without causing the application to freeze.

I rely on external file-change detection because I also use AI agents that directly modify my Markdown notes.

Actual behaviour

QOwnNotes intermittently becomes unresponsive when OneDrive is actively syncing my notes folder.

Pausing OneDrive synchronization resolves the issue, but this isn't a practical long-term solution since I need my notes to sync between devices.

Disabling external file-change detection also isn't an option because other applications and AI agents regularly modify my notes.

I'm currently running QOwnNotes 26.11.5 on Windows.

I'm wondering if OneDrive is triggering excessive filesystem events or repeated note-folder scans that cause the application to hang.

Steps to reproduce

  1. Store the QOwnNotes notes folder inside a OneDrive-synchronized directory.
  2. Keep external file-change detection enabled.
  3. Use QOwnNotes while OneDrive synchronizes files.
  4. QOwnNotes intermittently becomes unresponsive.
  5. Pause OneDrive syncing and observe that the freezes stop.

Screenshots

N/A

Output from the debug section in the settings dialog

Expand

Debug output to be added.

Relevant log output in the Log panel

Expand

Log output to be added.

Additional context

Related issues that may be relevant:

Ideally, there would be a way to handle filesystem changes from synchronization software efficiently without disabling external modification detection entirely.

Activity

  1. changed the title [-][BUG][/-] [+][BUG] QOwnNotes freezes during OneDrive synchronization[/+] on Nov 13, 2026
  2. pbek commented on Nov 14, 2026

    @pbek
    Owner

    Can you please fill out the rest of the issue template and provide your debug settings dump and logs while this happens?

  3. pbek commented on Nov 14, 2026

    @pbek
    Owner

    And can you please update to the latest version?

  4. pbek commented on Nov 14, 2026

    @pbek
    Owner

    There is a plausible explanation in the filesystem watcher handling: changes to a watched file other than the current note can trigger a full note-index scan. Directory changes can also trigger an immediate scan and another scan one second later. These scans run synchronously, so repeated notifications during synchronization could cause UI stalls, especially if filesystem access is slow. This is a possibility, not yet a confirmed diagnosis for your setup.

    In addition to the settings dump, debug logs and testing the latest version requested above, could you please clarify:

    • Approximately how many notes and subfolders are in your note folder, and is Show subfolders enabled?
    • Is the entire note folder marked Always keep on this device in OneDrive? If not, does marking it that way and waiting for the download to finish change the behavior?
    • Does QOwnNotes recover by itself? How long do the freezes usually last?
    • With debug logging enabled in the Log panel, do you see repeated messages such as Notes directory was modified externally, other note was changed, or deferred re-index after external directory change around a freeze? Please include those log entries; the status messages may be translated.

    The linked issues had fixes that predate 26.11.5, so they do not establish that this is the same problem. Updating is still important: 26.11.6 also fixed a separate issue where autosaving could overwrite external changes while the external-modification dialog was open, but that is not a confirmed fix for these freezes.

    If the logs do not reveal the cause, a Windows Process Monitor trace filtered to QOwnNotes.exe during a freeze would help identify which files and operations are involved. Please redact private paths or note names before sharing logs or traces.

  5. skylord123 commented on Nov 17, 2026

    @skylord123
    Author

    I upgraded yesterday from 26.11.5 to 26.11.10 and the issue got much worse: QOwnNotes locked up for several minutes until I gave up and force-killed it. I then tried 26.11.6, which doesn't have that multi-minute hang, but it still freezes when I edit a note and OneDrive syncs. Everything below is from 26.11.6. I can try to grab a log from 26.11.10 too if that helps.

    Sanitized log attached. User, org, note and folder names are replaced with placeholders, and the Nextcloud XML responses are removed.

    sanitized.log

    What the log shows

    This is one save (Ctrl+S) of a single note:

    Time Event
    10:44:22 Stored 1 note(s) to disk
    10:44:23 Notes directory was modified externally (for the subfolder containing the saved note, presumably OneDrive touching it)
    10:44:23 – 10:44:29 Full buildNotesIndex of every subfolder
    10:44:29 notesWereModified → "Modification date didn't change" / "Note text and _currentNoteTextHash are the same, ignoring"
    10:44:30 deferred re-index after external directory change
    10:44:30 – 10:44:37 Second full buildNotesIndex

    So it is the directory-change path you described: an immediate scan, then the deferred one. Each scan takes about 6–7 seconds, even though the note's content and modification date didn't change. I don't see other note was changed anywhere.

    Most of each scan isn't spent on notes. The checksum stats say only ~0.56 s total:

    Total calculateChecksum() calls: 4575
    Total time spent: 560.032 ms
    

    Most of the time goes to ~230 lines per scan like this, which together take ~4–5 s:

    Failed to add path to directory watcher:  "C:/Users/<user>/OneDrive - <org>/Notes/.git/objects/0f"
    

    My note folder is also a git repo. QOwnNotes' own git support is off (isUseGit: no), but the .git directory sits in the note folder. QOwnNotes tries to add every .git/objects/xx, .git/refs/... and .git/logs/... directory to the watcher, and every one of those calls fails slowly on OneDrive. My ignoreNoteSubFolders setting is the default ^\., so .git is correctly skipped for notes. That ignore pattern doesn't seem to apply to the directory watcher. Applying it there would probably remove most of the freeze. Avoiding the second scan when nothing actually changed would roughly halve what's left.

    Your questions

    Approximately how many notes and subfolders are in your note folder, and is Show subfolders enabled?

    QOwnNotes reports 169 notes. On disk the folder is 24.2 MB with 6,428 files and 294 folders. Most of the files are images I paste into notes. Most of the folders are .git internals: the log alone shows 268 different .git directories QOwnNotes tried to watch. Show subfolders is enabled (I use subfolders heavily).

    Is the entire note folder marked Always keep on this device in OneDrive?

    Yes, it already is.

    Does QOwnNotes recover by itself? How long do the freezes usually last?

    On 26.11.6 it recovers by itself. I just edited a note and pressed Ctrl+S: it froze for ~7 seconds, unfroze, then froze again within a second for another ~4 seconds. That matches the two scans in the log. On 26.11.10 it didn't recover within several minutes.

    I had this problem before and fixed it by enabling Ignore all external note folder changes. Now I use LLM agents to log things into my notes, so I need external changes to show up. Turning that setting back off is when the freezes came back.

    Debug information

    Trimmed to what seemed relevant and sanitized (paths, server, usernames, machine and domain names removed; system environment section dropped). I'm happy to provide more if needed.

    Expand
    ## General Info
    Version: 26.11.6
    Build date: Nov  7 2026
    Build number: 1415
    Platform: windows (windows)
    Operating System: Windows 11 Version 25H2
    Build architecture: x86_64
    Release: GitHub Actions
    Qt Version (build/runtime): 6.10.1 / 6.10.1
    Portable mode: no
    Application database path: C:\Users\<user>\AppData\Roaming\PBE\QOwnNotes\QOwnNotes.sqlite
    Application arguments: C:\Users\<user>\OneDrive - <org>\Documents\programs\qownnotes v26.11.6\QOwnNotes.exe
    Libgit2: yes
    Notes in current note folder: 169
    Enabled scripts: 0
    
    ## Server Info
    serverUrl: <nextcloud-host>
    appIsValid: no
    
    ## Note folder `default`
    id: 1
    isCurrent: yes
    localPath: C:\Users\<user>\OneDrive - <org>\Notes
    remotePath: Notes
    cloudConnectionId: 1
    isShowSubfolders: yes
    isUseGit: no
    allowDifferentNoteFileName: no
    database file: C:\Users\<user>\OneDrive - <org>\Notes\notes.sqlite
    
    ## Relevant settings
    acceptAllExternalModifications (bool): true
    ignoreAllExternalModifications (bool): false
    ignoreAllExternalNoteFolderChanges (bool): false
    notifyAllExternalModifications (bool): false
    ignoreNoteSubFolders (QString): ^\.
    ignoredNoteFiles (QString): <empty>
    enableNoteChecksumChecks (bool): true
    noteSaveIntervalTime (int): 10
    maxNoteFileSize (int): 1048576
    noteFileExtensionList (QStringList): md, txt
    automaticNoteFolderDatabaseClosing (bool): false
    gitCommitInterval (int): 30
    showNotesFromAllNoteSubFolders (QString): false
    noteSubfoldersPanelDisplayAsFullTree (bool): true
    noteSubfoldersPanelShowNotesRecursively (bool): false
    enableNoteTree (bool): false
    noteListPreview (bool): false
    Editor/showMarkdownImagePreviews (bool): true
    localTrash/supportEnabled (bool): true
    localTrash/mode (int): 2
    ownCloud/supportEnabled (bool): true
    todoCalendarSupport (bool): true
    ownCloud/todoCalendarBackend (int): 3
    enableSocketServer (bool): true
    enableWebAppSupport (bool): false
    ai/autocompleteEnabled (bool): false
    ai/mcpServerEnabled (bool): false
    Debug/fileLogging (bool): true
    
  6. pbek commented on Nov 17, 2026

    @pbek
    Owner

    Thank you for the detailed report and logs! They confirm the repeated scans and reveal that QOwnNotes unnecessarily traverses .git even with Git support disabled. I'll address that first while keeping external-change detection enabled.

    The much longer hang in 26.11.10 may have an additional cause. A log from that version would still be helpful, but isn't needed to begin fixing the unnecessary Git-directory traversal.

  7. skylord123 commented on Nov 17, 2026

    @skylord123
    Author

    The much longer hang in 26.11.10 may have an additional cause. A log from that version would still be helpful, but isn't needed to begin fixing the unnecessary Git-directory traversal.

    Sounds good! I'll fire up 26.11.10 again and see if I can capture some logs from the longer hang. I'll report back with whatever I find.

    Thanks for getting back to me so quickly and for digging into these issues! I really enjoy using QOwnNotes. It's become my go-to for both personal and work notes, so I really appreciate all the effort you put into maintaining and improving it!

  8. skylord123 commented on Nov 17, 2026

    @skylord123
    Author

    Got a log from 26.11.10. It covers one launch plus one edit + Ctrl+S. It's sanitized the same way as before (user, org, note and folder names replaced with placeholders, Nextcloud XML removed):

    sanitized.log

    Startup: 3m23s

    13:27:59  launch
    13:28:02  setupNoteFolderTables - 'database version': 16
              ... nothing logged for 3m23s ...
    13:31:25  "QOwnNotes server listening on port 22222"
    13:31:25  Note folder loading complete - Total calculateChecksum() calls: 169 (13 ms)
    

    During that gap the window doesn't appear. Task Manager shows the process with one thread using a full CPU core. Windows' per-process I/O counters showed ~20,000 "other" (non-read/write, i.e. metadata/directory) operations per second and almost no reads, about 2.7 million operations in the first ~2.5 minutes. No Failed to add path lines are logged during startup. This is most likely the multi-minute lock-up I mentioned before. Yesterday I also left one launch running and it had opened by the next morning.

    One save: ~89s frozen

    Time Event
    13:36:28 Stored 1 note(s) to disk
    13:36:30 Notes directory was modified externally (the saved note's subfolder)
    13:36:30 – 13:37:15 Scan #1: 45 s. 9 s with nothing logged, then ~230 Failed to add path to directory watcher lines
    13:37:15 notesWereModified → "Modification date didn't change" / "Note text and _currentNoteTextHash are the same, ignoring"
    13:37:16 deferred re-index after external directory change
    13:37:16 – 13:37:59 Scan #2: 43 s, another 228 watcher failures

    Compared with 26.11.6

    26.11.6 26.11.10
    Startup normal 3m23s
    Freeze per save ~6–7 s × 2 scans ~45 s × 2 scans
    Watcher failures per scan ~230 ~230
    Rate of watcher failures ~50/s ~5–6/s

    The number of failed watcher calls is the same; each call just takes ~9× longer in 26.11.10. Note checksumming is negligible in both (the cumulative checksum stats only went from 169 to 546 calls / 75 ms across startup and both scans).

    Two other things stood out:

    • Real note subfolders fail too now, not just .git. Example (note the mixed separators):
      Failed to add path to directory watcher:  "C:/Users/<user>/OneDrive - <org>/Notes\\folder-04"
      Failed to add path to directory watcher:  "C:/Users/<user>/OneDrive - <org>/Notes\\folder-04/folder-05"
      
    • Possible cause of the failures: Qt's QFileSystemWatcher::addPath() also returns false when the path is already being watched. If every re-index re-adds all directories that were added at startup, they would all "fail" this way. That would fit external changes still being detected even though the subfolders "fail". Just a guess from the Qt side; I haven't looked at the code.

    Correction to my earlier comment

    I said most of the 6,428 files in the note folder were images. I counted, and 6,205 of the 6,428 files and 267 of the 294 folders are inside .git. Only ~220 files are actual notes and images. So the note folder is mostly git internals, which makes the .git traversal fix even more relevant.

    I'm happy to test a build with the .git fix whenever it's ready.

    FYI, I'm using Claude Desktop on my work PC to pull and sanitize the logs and help triage this. If there's any more troubleshooting I can do on my end (a Process Monitor trace, a test build, different settings), just let me know.

  9. pbek commented on Nov 18, 2026

    @pbek
    Owner

    Thank you for the additional log and measurements! I've committed a targeted fix in 85ba97e: QOwnNotes no longer recursively traverses and watches .git internals. Those events were already ignored by the change handlers, so these watches served no useful purpose—even with QOwnNotes' Git support enabled.

    This also removes the repeated path-security checks across the thousands of Git files, which plausibly explains why 26.11.10 was much slower. The long startup gap in your log occurs where watcher setup runs; successful registrations aren't logged. We still need your testing to confirm how much this improves your Windows/OneDrive setup.

    External note-change detection remains enabled. The delayed follow-up scan is retained because it is needed to catch some sync clients' temporary-file/atomic-replacement updates. Existing watches are cleared before watcher setup, so duplicate registration isn't established as the explanation for the failures.

    Validation passed: the application build and full Linux VM test suite, including a new regression test verifying that Git internals remain unwatched after re-indexing while externally created notes are still detected and watched. This does not replace testing on Windows with OneDrive.

    When a Windows build containing this commit is available, could you please test it and report:

    • Startup time.
    • Freeze duration after editing and saving a note while OneDrive syncs.
    • Whether watcher failures remain for actual note folders (rather than .git).
    • Whether external edits from your agents still appear correctly.

    Please include a fresh sanitized log if significant freezes or note-folder watcher failures remain. Let's keep this issue open until we have those results.

  10. added a commit that references this issue on Nov 18, 2026
  11. pbek commented on Nov 18, 2026

    @pbek
    Owner

    There now is a new release (soon), could you please test it and report if it works for you?

  12. skylord123 commented on Nov 18, 2026

    @skylord123
    Author

    Just tested 26.11.11 and it's a huge improvement, thank you! Startup takes about 4 seconds again, and the watcher errors are gone. External edits from my agents are still picked up correctly.

    26.11.6 26.11.10 26.11.11
    Startup normal 3m23s ~3.5–4 s
    Freeze per save (re-index + deferred re-index) ~6–7 s × 2 ~45 s × 2 ~1.3–2.4 s × 2
    Watcher failures per scan ~230 ~230 0

    There is still a short freeze after each save, about 1.3 to 2.4 seconds twice (the initial re-index and the deferred one). With OneDrive paused there is no freeze at all, so I looked into what OneDrive does to trigger it.

    About 1.5 seconds after QOwnNotes saves a note, OneDrive sends an attribute-change notification for that file. Nothing visible actually changes: the file's attributes, size and modified time are identical before and after. I assume this is OneDrive updating its sync state on the file. Qt reports this as directoryChanged for the folder, and QOwnNotes then re-indexes the whole note folder. Qt's directory-only notification flags include attribute changes as well, so watching the note files separately from the folders would not avoid it.

    To find this, I recorded the note folder while saving and put everything on one millisecond timeline: filesystem changes in the note folder, which notification type each change raised, when the QOwnNotes window froze and for how long, CPU use of QOwnNotes and OneDrive, and the matching QOwnNotes log lines. The first run covers startup, a save with OneDrive paused (no reaction at all), and saves with OneDrive running. The second run has one watcher per notification type on the note's folder, which is where the attribute-only notification shows up. It's sanitized like the earlier logs (note and folder names are placeholders):

    sanitized.log

    This is already a huge improvement though. Would just be nice if it didn't freeze at all when OneDrive is involved.

  13. added a commit that references this issue on Nov 19, 2026
  14. pbek commented on Nov 19, 2026

    @pbek
    Owner

    Thanks for confirming that 26.11.11 brought startup back to about four seconds, eliminated the watcher errors, and still picks up your agents’ edits. The notification trace was especially helpful in narrowing down the two remaining stalls after a save.

    In the upcoming 26.11.13: on Windows, QOwnNotes checks the affected subfolder before rebuilding the full note index. If its notes and subfolders are unchanged, it skips the rebuild. The check compares note contents, not just file size and modification time, and falls back to the normal scan if it can’t verify the folder. Nearby notifications share one delayed check so sync clients that replace a file by renaming it can still be detected.

    Once the Windows build is available, could you try saving a note in the same subfolder with OneDrive running and let me know whether either stall remains? Please also check that an external edit from one of your agents still shows up. If it still stalls, a short log around one save would be helpful.

  15. added 2 commits that reference this issue on Nov 19, 2026
  16. skylord123 commented on Nov 19, 2026

    @skylord123
    Author

    Tested the next build with your subfolder check, and it works. Thank you!

    With OneDrive running, OneDrive's attribute-only notification still arrives about 1.5 seconds after each save, but QOwnNotes no longer rebuilds the index. There is no "Notes directory was modified externally" and no deferred re-index anymore.

    26.11.11 next (206d0bc)
    Re-index after save 2 full re-indexes none
    Freeze per save ~1.3–2.4 s × 2 ~0.4–0.8 s × 2

    An external edit from one of my agents was still picked up correctly. QOwnNotes re-indexed and reloaded the current note.

    There are still two short pauses of about half a second per save, at the moments the subfolder check and the delayed check run. My guess is that reading the folder's notes (about 100 notes, 1.4 MB) is what takes that time on OneDrive. It is barely noticeable, so I'm happy with it as is.

  17. pbek commented on Nov 19, 2026

    @pbek
    Owner

    Gereat, thank you for testing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions