Google Chrome has fixed a bug that enabled antivirus programs on Windows 10 to lock newly created files.

The patching of the bug means antivirus programs running on Windows would no longer block new files generated by the Chrome web browser, such as bookmarks.

Antivirus programs briefly lock new files

As a safety precaution, oftentimes antivirus programs temporarily lock newly generated files on a system until these can be scanned and ruled out for malicious activity.

On Windows 10 machines, in particular, this created issues for the Google Chrome web browser when it would use `ImportantFileWriter` to output certain files.

“Anti-virus programs and other scanners may briefly lock new files which can lead to frequent problems with saving bookmarks and other files that use the ImportantFileWriter,” explained Bruce Dawson, a Google engineer.

This meant Windows 10 users would experience issues trying to save bookmarks, for example, due to the web browser having difficulty creating the corresponding file.

As first reported by Windows Latest this week, a recent enhancement made by the Chromium project lets the Chrome web browser run smoothly on Windows 10, even when antivirus tools are enabled.

Fix attempts file creation multiple times

The fix published to Chromium’s Google Source codebase resolves this bug by retrying the execution of ReplaceFile method multiple times to overcome the possible race condition in which an antivirus program takes control of (and locks) a file being simultaneously accessed by Chrome.

The code change also has a machine learning aspect to it which means, over time Chromium will teach itself to fine-tune the number of attempts needed to bypass such race conditions.

Google Chrome fixes antivirus 'file locking' bug on Windows 10
Fix made by Chromium for Windows OS versions to retry new file creations multiple times
Source: Chromium Gerrit

“This change also adds instrumentation to record how many retries are needed, for future tuning,” stated Dawson.

The engineer also states this bug only impacts Windows systems which is why the fix made into important_file_writer.cc was specific to Windows OS, as shown in the screenshot above (line 45).

Since the fix has been merged into the repository as of December 30, 2020, it is expected the next version of Google Chrome will come shipped with it.

Chrome users should keep an eye out for any upcoming releases and ensure they update their web browsers promptly.