-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manage NtStatus.NT_STATUS_OBJECT_NAME_COLLISION in SmbFile.mkDir #338
Comments
I'd rather not generally suppress that error and also that might be an unexpected change for others. Can't you just use mkdirs then or catch the exception? |
Thanks for response. The fact is that I'm using vfs and the problem arises randomly when I execute fileObject.getContent().getOutputStream() method, when some folders in the path given in input need to be created by getOutputStream (using mkdir method, not mkdirs, unfortunatly). This is the code I use.
There are two processes using the code above, running concurrently that write different files but possibly on same sub paths. For now I added createParentFileObjects method to mitigate the exception.
Th problem is that also with createParentFileObjectsAttempts = 10, the collision exception randomly arises from fileObject.getContent().getOutputStream(), executed after all those attempts. This is very strange, because for what I can understand, mkdir checks if a folder exists (and so do I in createParentFileObjects) before creating it, and even if there could be timing issues due to the fact that checking and creating are not synchronized on the two different processes, all these reiterative attempts should succeed. Consider also that the path is long 4 folders max, also, and I noticed that, when the exception arises at last from getOutputStream only on of the two processes made those attempts, the other does not log any warning. So, I realized, that hiding in mkdir that exception, could not be a solution, but what do you suggest to avoid the collision issue? What did you understand, about this issue, that brought you to hide that exception in mkdirs? Thanks |
Back then, I concluded that the issue was caused by a race between multiple existance checks and the file creation, but that may not have been the whole story. |
Thanks, it seems to work. I will do some stress test to be sure! |
Unfortunatly, I've spoken too early, randomly the exception occurs even setting that prop to 0.
Are there other props I can set differently to figure it out? Thanks |
So you are still encountering repeated error for the same parent? |
Unfortunatly I could not do that yet, so I have no other information to share about this problem. I will update the issue with other info when possibile, but if you discover something about this problem in the meanwhile, update this issue, thanks. I will try other libraries to check if the problem exists in general, however |
Manage NtStatus.NT_STATUS_OBJECT_NAME_COLLISION error code on SmbFile.mkDir raises a SmbException in case of high concurrency level.
I noticed that for not known reasons this error code does not raise an exception on similar method mkDirs (note the final "s").
This has been justified by the following comment
Is it possibile to extend to mkDir method the same cautional behaviour?
The text was updated successfully, but these errors were encountered: