2394425147 / LC_CullFactory

8 stars 1 forks source link

Crashes when client joins host on v1.2.0 #17

Closed gogozooom closed 2 months ago

gogozooom commented 2 months ago

If you launch two instances of Lethal Company with CullFactory installed. If one hosts the server and the other client joins, the client crashes immediately. The log is not helpful, it just lists the DLLs and the EXEs used in the process.

image

The example above has only the CullFactory mod installed with a new config file. image

The temporary fix has been downgrading to v1.1.5

Zaggy1024 commented 2 months ago

I can reproduce the issue locally, but does this also happen when the host and client are on different machines? It's possible this is some sort of sharing violation.

gogozooom commented 2 months ago

Unsure, haven't tested it. However, it does make it a little annoying to test my own mod's development. (And great, I did the github thing, accidentally closing an issue)

Zaggy1024 commented 2 months ago

I asked on Discord and it seems like this only happens in LAN. The issue occurs in this call stack:

[0x0]   lib_burst_generated!Unity.Collections.NativeArray`1<System.Int32>::Unity.Collections.NativeArray`1<int>.get_Item+0x7   (Inline Function)   (Inline Function)   
[0x1]   lib_burst_generated!Unity.Netcode.Transports.UTP.BatchedSendQueue::Unity.Netcode.Transports.UTP.BatchedSendQueue.get_HeadIndex+0x7   (Inline Function)   (Inline Function)   
[0x2]   lib_burst_generated!Unity.Netcode.Transports.UTP.BatchedSendQueue::Unity.Netcode.Transports.UTP.BatchedSendQueue.get_IsEmpty+0x7   (Inline Function)   (Inline Function)   
[0x3]   lib_burst_generated!Unity.Netcode.Transports.UTP.UnityTransport/SendBatchedMessagesJob::Unity.Netcode.Transports.UTP.UnityTransport.SendBatchedMessagesJob.Execute+0x80   (Inline Function)   (Inline Function)   
[0x4]   lib_burst_generated!Unity.Jobs.IJobExtensions.JobStruct`1<Unity.Netcode.Transports.UTP.UnityTransport.SendBatchedMessagesJob>.Execute(ref Unity.Netcode.Transports.UTP.UnityTransport.SendBatchedMessagesJob data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_cc3481835e89840fd2938ba624363b1a from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null+0x9e   0xf07c2ec650   0x7ffa8bd74346   
[0x5]   lib_burst_generated!76b1071e4a758cb49b53b26b58023334_avx2+0x16   0xf07c2ec990   0x7ffa8bdcfd87   
[0x6]   lib_burst_generated!76b1071e4a758cb49b53b26b58023334+0x17   0xf07c2ec9d0   0x7ffa72debdbc   
[0x7]   UnityPlayer!ExecuteJob+0xfc   0xf07c2eca10   0x7ffa72dec6cc   
[0x8]   UnityPlayer!ForwardJobToManaged+0x2c   0xf07c2ecce0   0x7ffa72decd0e   
[0x9]   UnityPlayer!ScheduleManagedJob+0x1ee   0xf07c2ecd20   0x7ffa728d0a27   
[0xa]   UnityPlayer!JobsUtility_CUSTOM_Schedule_Injected+0x27   0xf07c2ed5d0   0x286b5b89ee5   
[0xb]   0x286b5b89ee5!+   0xf07c2ed620   0x0   

It seems like it's trying to use a null pointer, perhaps some static NativeArray instance. Unfortunately, I can't find any source code for this, so it'd be pretty difficult to figure out if there's a way to fix this properly.

I may try a hacky solution to disable burst if the user clicks on LAN or something, although I'd really rather avoid that if possible.

For reference, here's the disassembly at the point of the crash:

image

gogozooom commented 2 months ago

Interesting, that's a hard issue to debug. However, this is not really a high priority because it's a client-side mod. And because of that, there is no real need to test multiple instances of LAN on the same computer. But I'd say it's still good to keep a note of this for the small percentage of people who may be experiencing the same issue.

Other than that, thanks for looking into it!