rizonesoft / Notepad3

Notepad like text editor based on the Scintilla source code. Notepad3 based on code from Notepad2 and MiniPath on code from metapath. Download Notepad3:
https://www.rizonesoft.com/downloads/notepad3/
Other
4.96k stars 331 forks source link

Accessing LAN files will freeze when the other party is offline #5050

Open nil-ref opened 10 months ago

nil-ref commented 10 months ago

When I use notepad3 to open a file (smb) on the LAN, the other party is offline. Notepad3 will be stuck for more than ten seconds because it constantly detects whether the file has changed.

hpwamr commented 10 months ago

Hello @nil-ref ,

Which version of Notepad3 are you using, as recent versions may have fixed this issue. 🤔

This copy the Notepad3 related settings to the clipboard and permit to past the content here. 🙄

Have you tried with latest Notepad3 beta (see issue #1129)

nil-ref commented 10 months ago

The latest version: Notepad3 (x64) 6.23.1020.1 rc (05a5eafc)

nil-ref commented 10 months ago

default settings.

RaiKoHoff commented 10 months ago

The quick solution would be: switch off "file changed monitoring" for SMB file share. Notepad3 relies on two mechanisms for file change monitoring:

  1. Concurrently running monitoring thread, pushing events to check for file change if directory signals some change.
  2. File changed polling every n milliseconds (default 2000ms) Maybe 1.) is problematic on SMB network shares. Solution could be: options to choose between 1.) , 2.) or both (current default).
nil-ref commented 10 months ago

The cause of the problem lies in calling APIs such as GetFileAttributes that need to open files. These functions ultimately go through IopCreateFile->ObOpenObjectByName. However, they do not support asynchronous opening of files. Always wait/freeze when they go through the "\??\UNC\" NT path.

https://stackoverflow.com/questions/1142080/how-to-avoid-network-stalls-in-getfileattributes https://stackoverflow.com/questions/41300873/how-to-open-a-file-in-windows-asynchronously

Windows can't open a file asynchronously. Maybe this problem can only be solved using threads.

RaiKoHoff commented 10 months ago

@nil-ref : Thanks for providing this interesting readings on Stackoverflow - always a good source of expert knowledge. I am going to give it a try ..., needs some time ...