Skip to content
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

Pump related crash on the Unstable version #61

Closed
MajorMoth opened this issue Feb 22, 2023 · 15 comments · Fixed by #71
Closed

Pump related crash on the Unstable version #61

MajorMoth opened this issue Feb 22, 2023 · 15 comments · Fixed by #71
Assignees
Labels
Branch: Unstable Affects Steam Workshop Unstable. bug Something isn't working
Milestone

Comments

@MajorMoth
Copy link

Steps to reproduce:

  1. Put all the required mods in your load order (Mechtrauma UNSTABLE, Modding Toolkit, Cs For Barotrauma, Lua For Barotrauma)
  2. Host a server and start a mission in any submarine containing a mechtrauma pump.

The error message looks as follows:

Error while reading a message from server.
Exception thrown while reading segment EntityEvent at position 32.
Inner exception: Message byte position incorrect after reading an event for the entity "Central Water Pump (ID: 3)" (ID 3). The previous entity was "Barotrauma.Hull" (ID 1887) Read 160 bits, expected message length was 8 bits.
at Barotrauma.Networking.ClientEntityEventManager.Read(ServerNetSegment type, IReadMessage msg, Single sendingTime)
at Barotrauma.Networking.GameClient.<>c__DisplayClass116_0.b__0(ServerNetSegment segment, IReadMessage inc)
at Barotrauma.Networking.SegmentTableReader`1.Read(IReadMessage msg, SegmentDataReader segmentDataReader, ExceptionHandler exceptionHandler)

I've tested a bit and it seems to be an issue relating specifically to mechtrauma. (Loading it with just the dependencies still causes the crash)
The ship I loaded only consisted of an inner wall, hull, spawnpoint, a Water Pump T1, a Central Water Pump and a Water Drain.
Loading in a vanilla submarine with the mod active doesn't cause a crash.

@Torca2001
Copy link
Contributor

image
Appears to be a reflection error occurs on the dedicated server side.
The mod is failing to load in @TBN-MapleWheels

@MapleWheels
Copy link

MapleWheels commented Feb 23, 2023

image Appears to be a reflection error occurs on the dedicated server side. The mod is failing to load in @TBN-MapleWheels

Let me look into this. I'm not sure why it's failing to load.

@MapleWheels
Copy link

I can't reproduce this; @Imouto-Kaede can you send me the full log if that run/instance?

@dakkhuza
Copy link

launch dedicated server with the current unstable build, happens everytime you launch it

@Torca2001
Copy link
Contributor

I can't reproduce this; @Imouto-Kaede can you send me the full log if that run/instance?
The error won't occur instantly unless there is a Central Pump loaded in, The error will also occur if you try to turn on a generator.

@MapleWheels
Copy link

MapleWheels commented Feb 23, 2023

Hey @Torca2001 ,

It might be related to this error from 2 weeks ago;
image

Also, I did follow the steps. All turning on the generator does is kick me from the server in relation to the above error.

@dakkhuza
Copy link

You have to launch the luadedicatedserver.bat to see the full error, you won't see it on the client or if you host the server using the in-game hosting menu

@MapleWheels
Copy link

MapleWheels commented Feb 23, 2023

You have to launch the luadedicatedserver.bat to see the full error, you won't see it on the client or if you host the server using the in-game hosting menu

I always test with the Dedicated Server, that screenshot was from the dedicated server console. This is why I asked for full logs.

I just also tested with the unstable workshop version and that's how I got the above error. Not saying the error @Torca2001 post isn't happening, but I can't reproduce it on my side.

image

I got kicked after turning on the Diesel Generator and it's because of the above error. This produced the error that @Imouto-Kaede is having:
image

@Torca2001 This error is the one from a couple of weeks ago in dev chat where it wouldn't be registered. Let me see if I can fix it.

@dakkhuza
Copy link

Loading game settings
Loading MD5 hash cache
Initializing SteamManager
Initializing GameScreen
Setting breakpad minidump AppID = 602960
WARNING: Unrecognized element in affliction "buckled" (ReduceAffliction)
Selected sub: Azimuth
Selected shuttle: Hemulen
[02/22/2023 19:10:42]
  Starting the server...
[02/22/2023 19:10:42]
  Using Lidgren networking. Manual port forwarding may be required. If players cannot connect to the server, you may want to use the in-game hosting menu (which uses SteamP2P networking and does not require port forwarding).
Lua! Version ca9f232aaf
Cs! Version ca9f232aaf
Added Modding Toolkit 0.0.3.2 to Cs compilation. (Standard)
[Server] Modding Toolkit: Starting...
[Server] Modding Toolkit loading in Standard Mode.
ModConfigManager: Loading Assembly Plugins...
MCM: Scanning packages...
Found Assembly Path: C:\Users\Dak\AppData\Local\Daedalic Entertainment GmbH\Barotrauma\WorkshopMods\Installed\2890754956\bin\Server\Standard\Mechtrauma.plugin.dll
ReflectionUtils::AddNonAbstractAssemblyTypes() | RTFException: Unable to load Assembly Types from Mechtrauma.plugin, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
[Server] AssemblyPatcher::GetSafeType() | Could not load types from reflection. | Exception Details: Unable to load one or more of the requested types.
Access is denied: 'Barotrauma.Items.Components.OxygenGenerator'.
Access is denied: 'Barotrauma.Items.Components.Pump'.
Access is denied: 'Barotrauma.Items.Components.PowerContainer'.
Access is denied: 'Barotrauma.Items.Components.PowerTransfer'.
Access is denied: 'Barotrauma.Items.Components.Powered'.
Access is denied: 'Barotrauma.Items.Components.PowerContainer'.
Access is denied: 'Barotrauma.Items.Components.Powered'.
Access is denied: 'Barotrauma.Items.Components.Powered'.
[SV CS ERROR] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.FieldAccessException: Attempt by method 'Mechtrauma.Plugin.changePowerRules()' to access field 'Barotrauma.GameMain.LuaCs' failed.
   at Mechtrauma.Plugin.changePowerRules()
   at Mechtrauma.Plugin.Initialize()
   at ModdingToolkit.AssemblyManager.LoadPlugins(List`1& pInfo)
   at ModdingToolkit.PluginHelper.LoadAssemblies()
   at ModdingToolkit.Bootloader.Init()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
   at Barotrauma.LuaCsSetup.<>c.<Initialize>b__74_6(Type t) in B:\programming\c#\Barotrauma\Barotrauma\BarotraumaShared\SharedSource\LuaCs\LuaCsSetup.cs:line 357
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Barotrauma.LuaCsSetup.Initialize(Boolean forceEnableCs) in B:\programming\c#\Barotrauma\Barotrauma\BarotraumaShared\SharedSource\LuaCs\LuaCsSetup.cs:line 354                     
Using LuaSetup.lua from the content package.
Mechtrauma UNSTABLE 1.2.0.8
 - init.lua (Took 0.02205ms)
[SV LUA ERROR] "C:/Users/Dak/AppData/Local/Daedalic Entertainment GmbH/Barotrauma/WorkshopMods/Installed/2890754956/Lua/Scripts/Shared/mechtraumaFunctions.lua:(5,34-70): [clr]: System.TypeLoadException: Access is denied: 'Barotrauma.Items.Components.Powered'.
   at System.Reflection.RuntimeAssembly.GetType(QCallAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive, ObjectHandleOnStack assemblyLoadContext)
   at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
   at System.Reflection.Assembly.GetType(String name)
   at Barotrauma.LuaUserData.GetType(String typeName) in B:\programming\c#\Barotrauma\Barotrauma\BarotraumaShared\SharedSource\LuaCs\Lua\LuaClasses\LuaUserData.cs:line 33
   at Barotrauma.LuaUserData.RegisterType(String typeName) in B:\programming\c#\Barotrauma\Barotrauma\BarotraumaShared\SharedSource\LuaCs\Lua\LuaClasses\LuaUserData.cs:line 44
   at lambda_method4(Closure , Object , Object[] )
   at MoonSharp.Interpreter.Interop.MethodMemberDescriptor.Execute(Script script, Object obj, ScriptExecutionContext context, CallbackArguments args) in B:\programming\c#\Barotrauma\Libraries\moonsharp\MoonSharp.Interpreter\Interop\StandardDescriptors\ReflectionMemberDescriptors\MethodMemberDescriptor.cs:line 191
   at MoonSharp.Interpreter.Interop.OverloadedMethodMemberDescriptor.<>c__DisplayClass33_0.<GetCallback>b__0(ScriptExecutionContext context, CallbackArguments args) in B:\programming\c#\Barotrauma\Libraries\moonsharp\MoonSharp.Interpreter\Interop\StandardDescriptors\ReflectionMemberDescriptors\OverloadedMethodMemberDescriptor.cs:line 426
   at MoonSharp.Interpreter.CallbackFunction.Invoke(ScriptExecutionContext executionContext, IList`1 args, Boolean isMethodCall) in B:\programming\c#\Barotrauma\Libraries\moonsharp\MoonSharp.Interpreter\DataTypes\CallbackFunction.cs:line 58
   at MoonSharp.Interpreter.CoreLib.ErrorHandlingModule.SetErrorHandlerStrategy(String funcName, ScriptExecutionContext executionContext, CallbackArguments args, DynValue handlerBeforeUnwind) in B:\programming\c#\Barotrauma\Libraries\moonsharp\MoonSharp.Interpreter\CoreLib\ErrorHandlingModule.cs:line 28"                                                               
Performance Fix 1.0.11
 - init.lua (Took 0.00026ms)
Dont Open Debug Console On Errors 1.0.2
 - patch.lua (Took 0.00020ms)
BetterFabricatorUI 1.0.9
 - init.lua (Took 0.00089ms)
Sort Container UI 1.0.10
 - SortContainerUI.lua (Took 0.00647ms)
[02/22/2023 19:10:45]
  Server started```
Full error output from when I launch the dedicated server, this is from a fresh download of the unstable version, I cleared all my mod folders and re-downloaded everything.

@Torca2001
Copy link
Contributor

You have to launch the luadedicatedserver.bat to see the full error, you won't see it on the client or if you host the server using the in-game hosting menu

I always test with the Dedicated Server, that screenshot was from the dedicated server console. This is why I asked for full logs.

I just also tested with the unstable workshop version and that's how I got the above error. Not saying the error @Torca2001 post isn't happening, but I can't reproduce it on my side.

image

I got kicked after turning on the Diesel Generator and it's because of the above error. This produced the error that @Imouto-Kaede is having: image

Oh thought it was similar due to both being message misalignment. I have managed to reproduce the issue but the Central Pump has no extra networking information attached to it so not sure how it would misalign the network message

@MapleWheels
Copy link

Oh thought it was similar due to both being message misalignment. I have managed to reproduce the issue but the Central Pump has no extra networking information attached to it so not sure how it would misalign the network message

It does, vanilla pumps are network synced which is what it inherits from:
image

@Torca2001
Copy link
Contributor

Ah ok so the server isn't loading the C# and then the client is desyncing itself expecting more data it seems

@TBN-MapleWheels TBN-MapleWheels added bug Something isn't working Branch: Unstable Affects Steam Workshop Unstable. labels Mar 27, 2023
@TBN-MapleWheels TBN-MapleWheels added this to the v1.3 RC milestone Mar 27, 2023
@TBN-MapleWheels
Copy link
Collaborator

Should be fixed by PR #70 . Will leave this open until testing is completed.

@Torca2001
Copy link
Contributor

Unable to reproduce in latest build, pr should also fix possible abnormal behaviour.

@TBN-MapleWheels TBN-MapleWheels linked a pull request Mar 28, 2023 that will close this issue
@TBN-MapleWheels
Copy link
Collaborator

Addressed in #71 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Branch: Unstable Affects Steam Workshop Unstable. bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants