Description of the Issue
The NPPM_INTERNAL_RELOADSCROLLTOEND message is sent every time the monitored file is updated. The handler for this message calls buf->reload() synchronously.
If writes are frequent and the file is large (or IO slow), reload() will take longer to finish than it takes for more NPPM_INTERNAL_RELOADSCROLLTOEND messages to come in. Messages received while reload() is still running are queued up.
Each message will be handled in the order received until all have completed, even after writes have stopped.
Suppose reload() takes 250ms, and 100 writes are made over 10 seconds.
Notepad++ will be unresponsive for 25 seconds (the time it takes for 100 reloads), even though writing stopped after 10 seconds.
Ideally, the message handler should only set a flag showing that a reload is needed, and then return.
A separate timer should check the flag and if set, unset it and reload the file.
Steps to Reproduce the Issue
- In a command prompt run the following:
for /l %x in (1,1,1000) do echo line number %x >> testfile.txt
- While this runs, open the resulting testfile.txt in notepad++ and turn on file monitoring
Expected Behavior
Notepad++ should remain responsive as it updates the file, and stop reloading it once the command is finished.
Actual Behavior
Notepad++ is completely unresponsive until long after the command has finished.
Debug Information
Notepad++ v7.9.1 (64-bit)
Build time : Nov 2 2020 - 01:07:46
Path : C:\Program Files\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 1803
OS Build : 17134.2026
Current ANSI codepage : 1252
Plugins : mimeTools.dll NppConverter.dll NppExport.dll XMLTools.dll
Description of the Issue
The NPPM_INTERNAL_RELOADSCROLLTOEND message is sent every time the monitored file is updated. The handler for this message calls buf->reload() synchronously.
If writes are frequent and the file is large (or IO slow), reload() will take longer to finish than it takes for more NPPM_INTERNAL_RELOADSCROLLTOEND messages to come in. Messages received while reload() is still running are queued up.
Each message will be handled in the order received until all have completed, even after writes have stopped.
Suppose reload() takes 250ms, and 100 writes are made over 10 seconds.
Notepad++ will be unresponsive for 25 seconds (the time it takes for 100 reloads), even though writing stopped after 10 seconds.
Ideally, the message handler should only set a flag showing that a reload is needed, and then return.
A separate timer should check the flag and if set, unset it and reload the file.
Steps to Reproduce the Issue
for /l %x in (1,1,1000) do echo line number %x >> testfile.txtExpected Behavior
Notepad++ should remain responsive as it updates the file, and stop reloading it once the command is finished.
Actual Behavior
Notepad++ is completely unresponsive until long after the command has finished.
Debug Information
Notepad++ v7.9.1 (64-bit)
Build time : Nov 2 2020 - 01:07:46
Path : C:\Program Files\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 1803
OS Build : 17134.2026
Current ANSI codepage : 1252
Plugins : mimeTools.dll NppConverter.dll NppExport.dll XMLTools.dll