Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When monitoring a large file with frequent writes, notepad++ locks up #9661

Open
JohnCalin opened this issue Mar 15, 2021 · 3 comments
Open

Comments

@JohnCalin
Copy link

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

  1. In a command prompt run the following:
    for /l %x in (1,1,1000) do echo line number %x >> testfile.txt
  2. 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

@JohnCalin
Copy link
Author

Issue is still present in 8.4.5

@bryand7
Copy link

bryand7 commented Aug 5, 2023

Still a HUGE problem in 8.5.4
I LOVE Notepad++ ... EXCEPT FOR THIS - PLEASE FIX THIS ONE
Same problem has existed for YEARS
Please fix!!!!
I may have to go look at the code and fix it myself

@JohnCalin
Copy link
Author

Still a HUGE problem in 8.5.4 I LOVE Notepad++ ... EXCEPT FOR THIS - PLEASE FIX THIS ONE Same problem has existed for YEARS Please fix!!!! I may have to go look at the code and fix it myself

Thanks for commenting. I've been wondering for years if maybe I'm the only one who uses the monitor feature.
When I opened this issue I took a crack at tracking it down in the code, but only got as far as identifying the message responsible. My C++ isn't strong enough to fix it myself, at least not while I have a day job ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants