Minecraft-Console-Client icon indicating copy to clipboard operation
Minecraft-Console-Client copied to clipboard

Sharing violation - Chatlog

Open xXjojaXx opened this issue 4 years ago • 14 comments

Every few hours the bot keeps spamming Errors in the cinsole which say (shortened): Sharing violation on path [path of chatlog] at MCC.Chatbot. ChatLog

In my understanding that would mean that another program tries to use the same file on the same time or something about similar. But I dont think there is so it must have to do with a problen coming from MCC. Do you know what is wrong? Thanks

xXjojaXx avatar Feb 27 '21 12:02 xXjojaXx

Please provide the full stack trace (error log) and the script you are using.

ReinforceZwei avatar Feb 27 '21 13:02 ReinforceZwei

The ChatLog bot currently does not handle concurrency so if you are running multiple instances of MCC on the same log file, it might break with the exception you are describing.

ORelio avatar Feb 27 '21 21:02 ORelio

Thats very mystical because the name of the chatlogfile contains %username% and %server% and it shouldnt be possible that the same user is on the same server at the same time, I think.

xXjojaXx avatar Feb 28 '21 12:02 xXjojaXx

I think it would be clearer if you could post the whole error message with full stack trace just to make sure.

ORelio avatar Feb 28 '21 13:02 ORelio

For some reason it stopped popping up for some days since I wrote the last post. But now it's back again and this is the warning and ther error message which are appearing many times in a row when the error occurs:

17:29:01 [ERROR] OnTextReceived: Got error from MinecraftClient.ChatBots.ChatLog: System.IO.IOException: Sharing violation on path /root/Minecraft/chatlog-MinecraftName-ServerAdress.txt at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <533173d24dae460899d2b10975534bb0>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode) at MinecraftClient.ChatBots.ChatLog.save (System.String tosave) [0x0003d] in <0401b4e711114db0a8c3f277e178e060>:0 at MinecraftClient.ChatBots.ChatLog.GetText (System.String text) [0x00080] in <0401b4e711114db0a8c3f277e178e060>:0 at MinecraftClient.McClient+<>c__DisplayClass132_0.<OnTextReceived>b__0 (MinecraftClient.ChatBot bot) [0x00000] in <0401b4e711114db0a8c3f277e178e060>:0 at MinecraftClient.McClient.DispatchBotEvent (System.Action1[T] action, System.Collections.Generic.IEnumerable1[T] botList) [0x00022] in <0401b4e711114db0a8c3f277e178e060>:0

17:29:03 [WARN] OnInternalCommand: Got error from MinecraftClient.ChatBots.ChatLog: System.IO.IOException: Sharing violation on path /root/Minecraft/chatlog-MinecraftName-ServerAdress.txt at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <533173d24dae460899d2b10975534bb0>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode) at MinecraftClient.ChatBots.ChatLog.save (System.String tosave) [0x0003d] in <0401b4e711114db0a8c3f277e178e060>:0 at MinecraftClient.ChatBots.ChatLog.OnInternalCommand (System.String commandName, System.String commandParams, System.String result) [0x00016] in <0401b4e711114db0a8c3f277e178e060>:0 at MinecraftClient.McClient.PerformInternalCommand (System.String command, System.String& response_msg, System.Collections.Generic.Dictionary`2[TKey,TValue] localVars) [0x0012a] in <0401b4e711114db0a8c3f277e178e060>:0

xXjojaXx avatar Mar 03 '21 18:03 xXjojaXx

Are you running some script that would constantly use command? Since internal command and server chat uses different thread and they may cause this issue.

ReinforceZwei avatar Mar 04 '21 02:03 ReinforceZwei

I cant acces my files right now because my server is down for maintenance but I will look to find if any script could be the trigger of what you mentioned as soon as possible.

xXjojaXx avatar Mar 04 '21 14:03 xXjojaXx

@xXjojaXx Is it solved on your side?

ORelio avatar Mar 07 '21 15:03 ORelio

I will look on it for the next few days and report then if everything worked fine again. :)

xXjojaXx avatar Mar 08 '21 18:03 xXjojaXx

Now the error showed up again. I dont know why. The bot is on the newest version and there aren't multiple applications running in the same chatlog. Pls have a look in what the error might be again.

xXjojaXx avatar Mar 19 '21 19:03 xXjojaXx

Please provide log output...

ReinforceZwei avatar Mar 19 '21 19:03 ReinforceZwei

What do you mean with log output? If you mean the stacjtrace, its still the same as shown above

xXjojaXx avatar Mar 20 '21 09:03 xXjojaXx

This error still happens in the latest development build sometimes without multiple bot on one filenor something like that, still something to fix, but I dont get where it is coming from!

xXjojaXx avatar May 23 '21 23:05 xXjojaXx

Reopening - see stack trace in https://github.com/ORelio/Minecraft-Console-Client/issues/1607#issue-903040050

OnInternalCommand: Got error from MinecraftClient.ChatBots.ChatLog: System.IO.IOException: Sharing violation on path /root/Minecraft/chatlog-MinecraftName-ServerAdress.txt at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <533173d24dae460899d2b10975534bb0>:0 at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode) [0x00000] in <533173d24dae460899d2b10975534bb0>:0 at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode) at MinecraftClient.ChatBots.ChatLog.save (System.String tosave) [0x0003d] in <0401b4e711114db0a8c3f277e178e060>:0 at MinecraftClient.ChatBots.ChatLog.OnInternalCommand (System.String commandName, System.String commandParams, System.String result) [0x00016] in <0401b4e711114db0a8c3f277e178e060>:0 at MinecraftClient.McClient.PerformInternalCommand (System.String command, System.String& response_msg, System.Collections.Generic.Dictionary`2[TKey,TValue] localVars) [0x0012a] in <0401b4e711114db0a8c3f277e178e060>:0

ORelio avatar May 27 '21 06:05 ORelio