[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

ERROR_SHARING_VIOLATION when multithreading

Posted on 2013-01-11
5
Medium Priority
?
432 Views
Last Modified: 2013-01-30
Hi!

Not quite sure which topic to use here, if it's a Windows7-problem or a general network problem.

I make  a program that can run heavy calculations on several pcs connected (a little like SETI@home). It uses files as interface between processes. The program can run on different threads on the same machine. Almost.

It has been working fine for a long time on WinXP. But one beta-customer has problems with the new version (which introduces the hyperthreading) on Windows 7. On his machine, if I call:

MoveFile(fileA, fileB);

for a file on the network at the same time from 2 different threads, none of them get access! Both get ERROR_SHARING_VIOLATION. On the network here at work that _never_ happens.

If I do the same with local files, everything is OK.

What can the difference be? Some access rights on this directory related to sharing?

Shouldn't one of them be the first anyway and get full access, while the next one can only read? As it is now, the file doesn't even get _copied_!

Are there any other more threadsafe ways to achieve this? I wouldn't like to rewrite the whole structure of the program.
0
Comment
Question by:Knut Hunstad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 20

Expert Comment

by:strivoli
ID: 38767059
You should enable the appropriate auditing level on the destination system. Once you get the error, check the Windows Security Log on the destination and you should get a better idea why it fails.
0
 
LVL 8

Author Comment

by:Knut Hunstad
ID: 38786408
The file system is a DFS system with the files residing on non-Windows-servers, as I understood it. So there is no Windows security log to check on the destination.

The user was able to use a Windows server instead, so they have a workaround now. I still would like to find some solution to the original problem. The IT-people at the customer thought it might have something to with "opportunistic locking", but I haven't been able to find any conclusion as to why that would trigger this problem.
0
 
LVL 20

Accepted Solution

by:
strivoli earned 2000 total points
ID: 38834305
Even non-Windows-servers do have auditing. Usually it is syslog. I still suggest you to have a look at any syslog messages reporting locks that might be the reason of the problem. Syslog is configurable in a more or less verbose mode. You should find the better verbose level that suits your case: if it is too low you might miss important warning messages, if it is too high you might get too many messages (hundreds and even thousands per second) and as a result it could be very hard to find the messages related to your problem.
Please let me know.
0
 
LVL 8

Author Comment

by:Knut Hunstad
ID: 38834329
Thanks for trying! But since this user has a workaround and no other users have reported the same problem, I will simply let it rest. I can't really expect this user's it-department to be interested in helping me further when they have a solution for themselves...

I am confident that your suggestions are valid, however, and very happy that someone bothered to try to help me along! So I award you full points for your last answer.
0
 
LVL 20

Expert Comment

by:strivoli
ID: 38834347
Thank you for closing the question. Hope my suggestion will help in the future with the same or similar problem. Have a nice day!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question