* LUA Slow File Append

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
tatewise
Megastar
Posts: 27080
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

LUA Slow File Append

Post by tatewise » 06 Dec 2011 13:09

The FH LUA file system runs very slowly sometimes.
In some situations it appears to have frozen FH in a 'hung' state.
The following LUA Plugin exhibits the problem and takes nearly a minute to complete:

for i=1,500 do
     file, err = io.open('Test.log','a')
     if file == nil then error(err) end
     file:write('Data:0,1,'2'n')
     file:close()
end

The following elements must be present in the written line:
The word Data: at start or end of line
Some commas , separating other data
Pair of quotes ' or '

If a line such as file:write('Data=0 1 (2)n') is used instead, it completes within a second or two.

The problem appears to be not so much what is being written, but that the above key elements exist in lines in the file being appended.
It afflicts Windows 7 and Vista but not my copy of XP.

The problem came to light because my LUA Plugin was writing a log file using the word Data: and contained commas and quotes.
As the file grew large the LUA Plugin took several minutes to complete the log, and appeared to have 'hung'.
If the word Data: was changed to Data= it completed in a second or two.

ID:5616
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

LUA Slow File Append

Post by Jane » 06 Dec 2011 15:41

I have just pasted your code in to FH and it ran in under a second even when in the debugger. system : Win 7 x64

Is it possible another program on your system (a backup program or antivirus perhaps?) is conflicting.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27080
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

LUA Slow File Append

Post by tatewise » 06 Dec 2011 16:11

I have tried various things such as switching off Indexed Search to no avail.

It appears to be caused by Microsoft Security Essentials on its Settings tab Real-time protection options.
If I untick Monitor file and program activity on your computer the problem vanishes.

MSE is on Windows 7 and Vista but not XP.

Strange that such a specific combination of characters upset it.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply