Hi. I have a piece of code that is trying to write to disk many files in one second. However, it fails wince I have installed Kaspersky Anrivirus 2011.
Stream:= TFileStream.Create(sName, fmCreate);
The code totally worked with Kaspersky 2010 and also works with Kaspersky 2011 if I disable its scanners (it cannot be totally unloaded from memory - unless it is uninstalled). The code also works if (Kaspersky 2011 is running and) I write to disk slooooowly. So it obviously is not fast enough to handle my disk requests.
The error I get is EFCreateError ('Cannot create xxx file blablabla'). Error is random. Most of the files are written to disk. About 10% fail.
I have tried to get support but is impossible to find a real person at Kaspersky to speak with. Their so called 'support' is actually a FAQ data base. Of course it speaks about how to install the product and related stuff. There is nothing about programing-related issues. Any ideas?
PS: this has repercussions for the entire Delphi community! All our customers will fail to use Delphi software if they are using KIS 2011 as antivirus. For the moment I recommend to my users to disable their antivirus but I need a real solution.
It will be nice if a person with KIS 2011 can confirm the problem. Just create a tiny program that write 200 small files to disk using TFileStream.
UPDATE:
- The problem appears ONLY when the file does not exist and it is created (created as opposed to overwritten).
- Similar report: https://forums.embarcadero.com/thread.jspa?threadID=32751&tstart=15
- Similar report: http://forum.kaspersky.com/index.php?showtopic=120561
- A possible solution that popped in my mind is to detect if KIS is running and if it is, to put a delay after each writing to disk. Or at leat, let the user know there may be problems. Anybody knows how to detect if a service is running?
- I added a delay of 650ms (after each file creation) and the bug is still there). So is not about how fast you write to disk but about how many files you write.
- Just uninstalled KIS 2011. The problem does not appear anymore.
- Just reinstalled the good old KIS 2010. The bug is still there but it appear rarely (about every 300 files instead of about 30 as in KIS 2011).
- The problem was confirmed on a second computer.
- NEWS: The crash appears in TFileStream.Create however it may be caused by a function called earlier: TestWriteAccess. If I disable this function, the TFileStream.Create doesn't fail anymore. Well, this doesn't change things too much. No matter which line of code generates the error, the program still fails (randomly) to write files to disk while Kaspersky is running.
- Still waiting a response from a real person from Kaspersky...
- More automated responses received from Kaspersky support (I sent emails to support in several countries). All pointing to a FAQ database.
- I change my status from Kaspersky fan (and customer) to Kaspersky hater because I finally receive an answer from a real person from Kaspersky support: I quote "Is het waar of just loads of bollocks? Met vriendelijke groeten, Kaspersky Lab B.V. Papendorpseweg 77-79". Kaspersky may be indeed a pirate company. They don't want to answer the emails because they know their s****y product is too buggy to be fixed.
Steps to reproduce the bug:
1) Test if the user has write permissions to a file/folder (create a file and immediately delete it).
2) Test if success/fail.
3) If success, create the file (again) and write content to it.
The combination create/delete/create will trigger KIS bug if repeated many times per second (~30 times for KIS2011, 300 times for KIS 2010).
Delphi 7, Win 7 (32), KIS 2011