# Sharing violation

Details Message
Author
Alexey Trifonov
Posted
22-Oct-2018 15:11 GMT
Toolset
ARM
Sharing violation

Hello,

I am currently using a µvision V5.26.2.0 and sometimes I can't save source file ( h , cpp ).

When it happened the pop ups window showing this message:

"Encountered a sharing violation while accessing {Path to me source file}"

The only one way that can change this behavior is to restart the µvision IDE.

Can I do something else?

Author
Andrew Neil
Posted
22-Oct-2018 15:18 GMT
Toolset
None
RE: Sharing violation

So is the file on a shared or networked drive?

Are you trying to access the file simultaneously from other application(s)?

Do you have backup and/or antivirus software running?

Author
Alexey Trifonov
Posted
22-Oct-2018 16:06 GMT
Toolset
None
RE: Sharing violation

The project is located on local disk and only µvision IDE accessing the files.

Yes, There is a antivirus software running but it has been running with previous version of

µvision IDE, before I have updated it.

The previous version has worked without pop up windows.

Author
Julian Gerber
Posted
24-Oct-2018 09:33 GMT
Toolset
None
RE: Sharing violation

I'm experiencing the same problem with uVision, v5.26.2.0. Also have the files on my local disk, not on my dropbox folder, am not running one drive - only thing that might be accessing it is antivirus (eset NOD32). Once the problem happens, it is impossible to save that file until the IDE is restarted.

Author
Rowland W
Posted
25-Oct-2018 10:55 GMT
Toolset
None
RE: Sharing violation

I'm having the same issue, and again using Version 5.26.2.0

I have now activated the "File & Project Handling" setting to Auto save and create a backup files (.BAK). All this is in the Edit/Configuration/...

I'm hoping that the backup file will help..... I have yet to determine if this is the case.

Is this a recognised bug with uVersion / arm?

Regards, R.

Author
K N
Posted
25-Oct-2018 17:30 GMT
Toolset
None
RE: Sharing violation

I have the same problem with my header file using MDK 5.26.2.0.
Unless SOMEBODY submit the service ticket with active maintenance service, Keil (Arm) will not consider these issues seriously.
(I tried to talk with their chatbot but they do not take any action.)

Author
Kevin From Support
Posted
25-Oct-2018 20:27 GMT
Toolset
None
RE: Sharing violation

Hello Rowland,

I have seen some random reports of a similar issue coming in, but we still can't reproduce it. Every instance seems to be slightly different setup.

We assume that the PC is running some other processes in the background e.g. Virus Scanner, Windows Indexing Service, Software Version Control Systems, Onedrive. etc. - that may be causing a conflict.

If you could duplicate this issue in an acceptable time frame, we would be happy if you could make some tests with the Process Monitor from Sysinternals/Microsoft. You could add a filter to a folder where your header files are located (Filter: Path contains .... then Include). You could then start the recording, work with uVision and as soon as the problem shows up, you stop the recording and note the header file name which was reported in the error message. Then you could store the recording, create a support ticket and send it to us.

Author
rowland w
Posted
29-Oct-2018 13:18 GMT
Toolset
None
RE: Sharing violation

Kevin,

I have managed to capture the Sharing Violation error and had Sysinterals running.

So, I have a couple of files that may be of interest....

I've managed to compress one of the files to 12Mb, which I may be able to email...

Regards,

Rowland

Author
rowland w
Posted
31-Oct-2018 10:16 GMT
Toolset
None
RE: Sharing violation

Dear Kevin From Support,

Do you want these SysInternals log files?

Regards,

Rowland

Author
Posted
6-Nov-2018 23:43 GMT
Toolset
ARM
RE: Sharing violation

I've seen these sharing violations since upgrading to uVision 5.26.2. I'm running a Windows 10 machine with Trend Micro antivirus, which is managed centrally.

I ran Process Monitor. It seems to show a sharing violation between uv4.exe and tmbmsrv.exe.

3:23:27.3855127 PM   UV4.exe       2832   QueryNetworkOpenInformationFile   C:\Users\u100137\path\to\file.h   SUCCESS             CreationTime: 10/10/2018 8:39:57 AM, LastAccessTime: 10/11/2018 12:38:53 PM, LastWriteTime: 11/6/2018 12:33:02 PM, ChangeTime: 11/6/2018 12:33:02 PM, AllocationSize: 32768, EndOfFile: 31682, FileAttributes: A
3:23:27.3855278 PM   UV4.exe       2832   CloseFile                         C:\Users\u100137\path\to\file.h   SUCCESS
3:23:27.3857638 PM   UV4.exe       2832   CreateFile                        C:\Users\u100137\path\to\file.h   SHARING VIOLATION   Desired Access: Generic Write, Read Attributes, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: n/a
3:23:27.3860568 PM   TMBMSRV.exe   6288   CreateFile                        C:\Users\u100137\path\to\file.h   SUCCESS             Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
3:23:27.3860897 PM   TMBMSRV.exe   6288   QueryNetworkOpenInformationFile   C:\Users\u100137\path\to\file.h   SUCCESS             CreationTime: 10/10/2018 8:39:57 AM, LastAccessTime: 10/11/2018 12:38:53 PM, LastWriteTime: 11/6/2018 12:33:02 PM, ChangeTime: 11/6/2018 12:33:02 PM, AllocationSize: 32768, EndOfFile: 31682, FileAttributes: A
3:23:27.3861051 PM   TMBMSRV.exe   6288   CloseFile                         C:\Users\u100137\path\to\file.h   SUCCESS

Author
Rowland w
Posted
7-Nov-2018 10:43 GMT
Toolset
ARM
RE: Sharing violation

Have you managed to disable: tmbmsrv.exe and prove that the sharing issue is resolved?

I have Trend Micro antivirus, which is managed centrally too.

Regards,

Rowland

Author
Posted
7-Nov-2018 17:11 GMT
Toolset
ARM
RE: Sharing violation

I don't have the ability to disable TrendMicro, even for a short period. I tried killing it from Task Manager and that didn't work. I could try one of the SysInternals tools to really zap it. I suspect it would respawn pretty quickly.

From some of the other comments in this thread, Keil is aware and has a support ticket open. I'm hoping for a fix soon. I think I can always fall back to editing outside Keil, and build/debug in Keil while I wait for the fix.

Author
Ron Wedge
Posted
25-Oct-2018 20:20 GMT
Toolset
ARM
RE: Sharing violation

Hello Alexey,

I am trying to get a feel for your environment.

I assume this is Windows10 OS, and that your Keil tools are installed in the c:\keil_v5\ folder

- Are you sharing the computer with another user? Could they be logged into the same machine?
- Are you using Microsoft System Center Endpoint Protection aka Windows Defender as your anti-virus tool?

It would be good to know what is locking the file. There are 3 methods I've tried, and sometimes one uncovers something the others don't/

* Use the built-in Resource Monitor: https://superuser.com/questions/117902/find-out-which-process-is-locking-a-file-or-folder-in-
windows

* Use Powershell: https://gallery.technet.microsoft.com/How-to-find-out-which-c0d4e60e
(to open powershell https://www.isunshare.com/windows-10/5-ways-to-open-windows-powershell-in-windows-10.html)

* Use Process Explorer: https://blogs.technet.microsoft.com/markrussinovich/2005/04/24/the-case-of-the-mysterious-locked-file/

... Once you figure out who is locking the file (probably an antivirus program) you can take steps to stop it, like in https://support.microsoft.com/en-us/help/4028485/windows-10-add-an-exclusion-to-windows-security

=====

In the Keil µVision IDE, under "Edit-> Configuration", on the "Editor" tab, on the middle-right of the dialog, under "File and Project Handling" do you have any check boxes set? You can read about these settings here:

Maybe a setting there is causing issues.

Author
Alexey Trifonov
Posted
26-Oct-2018 10:38 GMT
Toolset
ARM
RE: Sharing violation

Hello Ron,

1. The "File and Project Handling" section is unchecked. ( as a default )
2. I am using a Windows 7 Enterprise version.
3. The Keil is installed in the C:\Keil_v5.
4. The source code is on drive D: ( Local drive , shrink partition ).
6. I am not using the "Microsoft System Center Endpoint Protection".
7. The anti-virus is Trend Micro.

This issue is an internal bug I guess so.

The reason why I am thinking so,

There is only one way to improve this behavior and is to restart an application ( Keil ).

I will try to understand the sequence of my usage that leads an issue.

Author
Andrew Neil
Posted
26-Oct-2018 11:01 GMT
Toolset
ARM
RE: This issue is an internal bug I guess so

Just more guessing, but:

* That the file gets locked may be nothing to do with Keil;

* That uVision does not recover after it's happened possibly (probably?) is to do with Keil.

Author
Alexey Trifonov
Posted
26-Oct-2018 11:33 GMT
Toolset
ARM
RE: This issue is an internal bug I guess so

And maybe one important thought, when it is locked in a Keil and I can't save the file.

I can do it in a standard editor, edit, save and the Keil allows to import changes event it has locked.

Author
Westonsupermare Pier
Posted
26-Oct-2018 21:38 GMT
Toolset
ARM
RE: This issue is an internal bug I guess so

Observed this here today, the IDE is holding the share, closing the project is not sufficient to clear this. Closing the tool down and restarting, and loading the project then worked.

File is not shared on a network, file is not open for view/mapped in any other application.

Got a resource leak here guys...

Author
Westonsupermare Pier
Posted
26-Oct-2018 21:48 GMT
Toolset
ARM
RE: This issue is an internal bug I guess so

Some additional info if it helps

uV 5.26 pre install
Win7 64-bit, QC Xeon, 16 GB RAM

Occurred after enabling browse information and rebuilding, a couple of build cycles ago, bit slow otherwise.

File in question will cause very large change in dependency tree, perhaps background syntax checking of all files in project and library. stm32l4xx_hal_conf.h

Doing a quick edit, and rebuild.

Author
Alexey Trifonov
Posted
3-Dec-2018 11:03 GMT
Toolset
ARM
RE: Sharing violation

Hello,

I have got some direction, might be helpful.

The issue happened quite often when, I am editing the code without compilation.

For Example:

Good scenario - I am pressing the "F7" after a couple of written rows.

Bad scenario - I am not compiling for a long time and making a lot of changes in a ".cpp" file and then, I am pasting the method declaration into the ".h" file.

Author
Sankalp Agarwal
Posted
3-Dec-2018 13:30 GMT
Toolset
ARM
RE: Sharing violation

This issue has been resolved and contact technical support team at support.intl@keil.com for a patch.

Author
Alexey Trifonov
Posted
3-Dec-2018 13:40 GMT
Toolset
ARM
RE: Sharing violation

Really!

Thank you for notifying me!!!!

Author
SelÃ§uk YÄ±lmaz
Posted
20-Feb-2019 11:37 GMT
Toolset
ARM
RE: Sharing violation

I have the same issue and agree with you.

Author
Kevin from Support
Posted
23-Feb-2019 00:56 GMT
Toolset
ARM
RE: Sharing violation

This edition should resolve most users issues with sharing violations.

Author
Werner Meier
Posted
29-Oct-2018 05:05 GMT
Toolset
ARM
RE: Sharing violation

Same sharing problem with me. Only observed it since about 1 month. In one environment at work, local folder is observed by GitHub, on other environment it's on a dropbox folder. (I used to work on dropbox folders for about 2 years, never happened)
Only *.h files seem to be affected. The IDE shows the latest edited version but trying to save it, pops this message. I can copy the content, create a new file, save it,then restart IDE. Otherwise all editing is lost.

Author
Werner Meier
Posted
7-Nov-2018 13:29 GMT
Toolset
ARM
RE: Sharing violation

for about a week I did not have the issue anymore..
Vague Theory: Micro Soft patch started sharing problem, now with another patch it disappeared?

Author
Werner Meier
Posted
7-Nov-2018 15:29 GMT
Toolset
ARM
RE: Sharing violation

ups, happened again.. so vague theory is false :)

Author
artnect
Posted
29-Oct-2018 19:54 GMT
Toolset
ARM
RE: Sharing violation

have you tried opening uvision as admin ?

click on uvision exe file and ---> properties -->compatibility----> run this program as administrator

Author
Jeff Cesnik
Posted
30-Oct-2018 16:45 GMT
Toolset
ARM
RE: Sharing violation

Experiencing the same issue. Windows 10, uVision 5.26.2.0, only .h files affected. Running as admin seems to fix it, at least I haven't experienced it again (yet)...

Author
Rowland W
Posted
30-Oct-2018 16:58 GMT
Toolset
ARM
RE: Sharing violation

Same situation, I have tried running under Admin, but this did not solve the problem.

Regards, R.

Author
Westonsupermare Pier
Posted
31-Oct-2018 00:29 GMT
Toolset
ARM
RE: Sharing violation

Restarting the application makes it go away, because Windows closes all handles owned by the application/task as it tears it down.

The issue is the app fails to CloseHandle() on the file, likely a Mapped View, and owned by the Pager, perhaps a premature exit of a function which might otherwise have closed it.

Don't think Admin makes much difference in this, as it's effectively owned by the Kernel.

Would agree it is mostly likely to be seen in .H due to the dependency changes those would make.

Other theory is task doing dependency checking wins race condition with task saving file.

Author
Carsten Groen
Posted
7-Nov-2018 13:59 GMT
Toolset
ARM
RE: Sharing violation

I have reported this to support. They are working on it (they already had a case opened with the problem). I will get a notice from them once they figure this out
I can also confirm that running in admin has no change. I have also just changed my development PC a week ago, the problem also occurs on this fresh installation (all files/projects are local disk, no SVN etc etc)

Author
Rowland w
Posted
7-Nov-2018 14:03 GMT
Toolset
ARM
RE: Sharing violation

Afternoon Carsten,

Do you have Trend Micro antivirus installed and tmbmsrv.exe running?

Regards,

Rowland

Author
Carsten Groen
Posted
7-Nov-2018 14:07 GMT
Toolset
ARM
RE: Sharing violation

Rowland,
nope, none of them. In fact, the workstation right now is just a basic Win10 installation, nothing fancy (yet)

Author
Westonsupermare Pier
Posted
7-Nov-2018 21:42 GMT
Toolset
ARM
RE: Sharing violation

I'm not using Tread Micro, this is a self-induced resource leak, or race condition.

Author
Seng Tak Goh
Posted
16-Nov-2018 09:10 GMT
Toolset
ARM
RE: Sharing violation

Oh my has this issue been resolved already?

I m using uVision 5.26.2 and in one of the occasions it destroyed my few hours of work.

Author
Carsten Groen
Posted
16-Nov-2018 09:13 GMT
Toolset
ARM
RE: Sharing violation

How can this destroy hours of work ?
In my case, when I get the "sharing violation" I just press CTRL-A and CTRL-C, closes uVision, opens it again (the file that had sharing violation even has the focus after uVision is re-opened) and press CTRL-A and CTRL-V, and all is on track again ?

Author
Seng Tak Goh
Posted
16-Nov-2018 09:17 GMT
Toolset
ARM
RE: Sharing violation

I do the same most of the time.

But in that occasion, I was in a rush to finish off work and leave the work place.

The sharing violation happened to not one but all the .H files opened. It will not show the error message again if you press 'save all' button unless you click on the individual tab in the editor again.

So in the end I missed saving one of the files and went home. Guess what I found out the next day?

I meant this kind of bug is quite in-tolerable to me.

Author
Carsten Groen
Posted
16-Nov-2018 09:20 GMT
Toolset
ARM
RE: Sharing violation

Ah, that figures!
I have (so far) only had a single error at a time, probably because CTRL-S is so firmly layered in my fingers ;)
But agree, it would be VERY nice if the bug could be removed ASAP!

Author
Kevin From Support
Posted
16-Nov-2018 18:45 GMT
Toolset
ARM
RE: Sharing violation

Hello Carsten,

Please open an support ticket with Keil, and they can try to get you an early release of the fix.

Author
Carsten Groen
Posted
17-Nov-2018 09:23 GMT
Toolset
ARM
RE: Sharing violation

Kevin,
I already did at Nov 5th (Sankalp is on it)
Looking forward to get a fix for this one :)

Author
Chen Tang
Posted
16-Nov-2018 14:28 GMT
Toolset
ARM
RE: Sharing violation

MDK development team is working on a solution now.
This "sharing violation" issue should be fixed in the next MDK release (newer than MDK v5.26))

Author
Andrew Neil
Posted
17-Nov-2018 09:51 GMT
Toolset
ARM
RE: MDK development team is working on a solution now.

Does that mean they've identified the problem?

If so, is there anything people can do to avoid it while we await the solution?

Is it purely an ARM MDK thing, or are the other architectures also affected?

Author
pavel A
Posted
19-Nov-2018 23:20 GMT
Toolset
ARM
RE: MDK development team is working on a solution now.

I've seen this error only once after update to 5.26.2, on Win10 1803.
When this error pops up, changes made in the IDE in affected files are lost, even the files appear as saved. So if you made valuable changes, copy the affected file out of the editor and save elsewhere.
Have not seen this with other apps.

-- pa

Author
Seng Tak Goh
Posted
20-Nov-2018 06:54 GMT
Toolset
ARM
RE: MDK development team is working on a solution now.

As in my case, I am developing in Win 7 and it happens at least twice in a day.

Author
Posted
4-Dec-2018 14:51 GMT
Toolset
ARM
RE: Sharing violation

Same issue here. Win10, all work done on local hard drive, sharing violation with my header files, sporadically. Sometimes they save, sometimes they don't. Hoping for a fix soon.

Author
Carsten Groen
Posted
4-Dec-2018 14:54 GMT
Toolset
ARM
RE: Sharing violation

It has already been fixed, see above (stupid order when looking thru the thread)
I have a version that has been running perfect for a week now, will be released by ARM/Keil in the near future

Author
Sankalp Agarwal
Posted
19-Dec-2018 09:28 GMT
Toolset
ARM
RE: Sharing violation

Just to add, the fix will also be available with next MDKv5.27 pre-release which will be available around Christmas and will be available to download from http://www2.keil.com/mdk5/

Author
Carsten Groen
Posted
14-Jan-2019 09:10 GMT
Toolset
ARM
RE: Sharing violation

Just as a note, I'm running with the new 5.27 prerelease and I now (although seldom) see "Error number: 22" when saving a .h file. So it seems the error is not completely gone (at least not for me). The frequency of it is however much lower than before!

Author
Kevin From Support
Posted
14-Jan-2019 23:00 GMT
Toolset
ARM
RE: Sharing violation

Hello All,

You can download the 'MDK v5.27 pre-release' by going to http://www2.keil.com/mdk5/ and

This edition should resolve most users issues with sharing violations.

Best regards,

Kevin

Author
Andrew Neil
Posted
15-Jan-2019 09:17 GMT
Toolset
ARM
RE: This edition should resolve most users issues with sharing violations

"most" ?!

Author
Westonsupermare Pier
Posted
15-Jan-2019 13:47 GMT
Toolset
ARM
most?!

It is called hedging..

What did the underlying issue turn out to be?

Author
Andrew Neil
Posted
20-Feb-2019 12:27 GMT
Toolset
ARM
RE: What did the underlying issue turn out to be?

would be interesting to know!

Author
Kevin From Support
Posted
1-Mar-2019 23:18 GMT
Toolset
ARM
RE: most?!

We made were making the IDE more robust, but were checking things in an order that could sometimes cause an issue.

Re-arranging the process that we did that seems to resolve the issue that sparked this thread.

Author
Seng Tak Goh
Posted
5-Apr-2019 15:29 GMT
Toolset
ARM
RE: Sharing violation

Hi,

Am using release 5.27 and something similar popped up again.

On recent closure there was an error for saving a header file with error number 22.

Seng Tak

Posted
9-Apr-2019 13:35 GMT
Toolset
ARM
RE: Sharing violation

I want to share a site that helps me in education. They will help you write an essay. Check out their professionalism yourself. Leave the application online. And you get a good grade.

Posted
9-Apr-2019 13:38 GMT
Toolset
ARM
RE: Sharing violation

https://essayonlineservice.org/ Here are the best writers. They will help you write an essay. Check out their professionalism yourself. Leave the application online. And you get a good grade.

##### Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.