Teardown-Issue-Tracker-Maintainers / Teardown-Issue-Tracker

A public repo for the community to track issues/bugs/feature requests in Teardown.
11 stars 6 forks source link

[Feature] Snapshot script status just before crash #554

Open YuLun-bili opened 2 months ago

YuLun-bili commented 2 months ago

Is your feature request related to a problem (if not, explain why you think this feature should be added)? Please describe.

Crash caused by a script have no trace in log.txt (#553) or crash dump files, making this specific type of troubleshooting more difficult especially when happened on a normal player's pc with no/limited modding knowledge.

Describe the solution you'd like

Game could try to record last function called from script so that when a crash happened we at least could know what the game was doing. Recording script environment or arguments passed would be more helpful although I think these could be optional.

An example of what I'm expecting to see in log or crashdump when a crash happens can be:

--------------
CRASH DETECTED
--------------
last function call:
[.../Teardown/mods/Local test mod/test.lua]:27: Spawn()
parameters passed:
1: [string] "<vehicle/>"
2: [none] (using default)
3: [none] (using default)
4: [none] (using default)
check script_env_dump.txt for script environment

Describe alternatives you've considered

well alternatives are just what we have currently

Additional context

As I have limited knowledge on software development and crash handling, some ideas might be not practically possible.

FlorentP42 commented 1 month ago

@Gregory-Gregory Any news on this? I am currently trying to investigate a crash experienced by a subscriber of one of my mods, and without this I fear I will not be able to tell what's wrong with his game when it works perfectly fine on mine...

Gregory-Gregory commented 1 month ago

@FlorentP42 I checked with the team and get back to you if I get any answer regarding this.

FlorentP42 commented 1 month ago

Actually there may be some level of info printed already: I got this from the log.txt of the person I was talking about earlier:

2592 00:03:12.692108 ERROR edd5 [] TBufferD3D12::TBufferD3D12:46 gpuMemAllocator->CreateResource( &allocationDesc, &bufferDesc, translateResourceState(heapTypeToResourceType[params.heapType].value), nullptr, mAllocation.GetAddressOf(), IID_ID3D12Resource, nullptr) return HRESULT=8007000e
2592 00:03:12.706314 ERROR edd5 [] {
  "General": {
    "API": "Direct3D 12", 
    "GPU": "AMD Radeon(TM) Graphics", 
    "DedicatedVideoMemory": 519634944, 
    "DedicatedSystemMemory": 0, 
    "SharedSystemMemory": 3933186048, 
    "ResourceHeapTier": 2, 
    "ResourceBindingTier": 3, 
    "TiledResourcesTier": 3, 
    "TileBasedRenderer": false, 
    "UMA": true, 
    "CacheCoherentUMA": false
  }, 
  "Total": {
    "BlockCount": 697, 
    "BlockBytes": 3934060544, 
    "AllocationCount": 3251, 
    "AllocationBytes": 3882266624, 
    "UnusedRangeCount": 2, 
    "AllocationSizeMin": 4096, 
    "AllocationSizeMax": 201326592, 
    "UnusedRangeSizeMin": 20480, 
    "UnusedRangeSizeMax": 51773440
  }, 
  "MemoryInfo": {
    "L0": {
      "Budget": {
        "BudgetBytes": 3540794471, 
        "UsageBytes": 4229804032
      }, 
      "Stats": {
        "BlockCount": 697, 
        "BlockBytes": 3934060544, 
        "AllocationCount": 3251, 
        "AllocationBytes": 3882266624, 
        "UnusedRangeCount": 2, 
        "AllocationSizeMin": 4096, 
        "AllocationSizeMax": 201326592, 
        "UnusedRangeSizeMin": 20480, 
        "UnusedRangeSizeMax": 51773440
      }, 
      "MemoryPools": {
        "DEFAULT": {
          "Stats": {
            "BlockCount": 29, 
            "BlockBytes": 3143892992, 
            "AllocationCount": 2583, 
            "AllocationBytes": 3092099072, 
            "UnusedRangeCount": 2, 
            "AllocationSizeMin": 4096, 
            "AllocationSizeMax": 201326592, 
            "UnusedRangeSizeMin": 20480, 
            "UnusedRangeSizeMax": 51773440
          }
        }, 
        "UPLOAD": {
          "Stats": {
            "BlockCount": 667, 
            "BlockBytes": 790102016, 
            "AllocationCount": 667, 
            "AllocationBytes": 790102016, 
            "UnusedRangeCount": 0, 
            "AllocationSizeMin": 1048576, 
            "AllocationSizeMax": 33554432
          }
        }, 
        "READBACK": {
          "Stats": {
            "BlockCount": 1, 
            "BlockBytes": 65536, 
            "AllocationCount": 1, 
            "AllocationBytes": 65536, 
            "UnusedRangeCount": 0
          }
        }, 
        "CUSTOM": {
          "Stats": {
            "BlockCount": 0, 
            "BlockBytes": 0, 
            "AllocationCount": 0, 
            "AllocationBytes": 0, 
            "UnusedRangeCount": 0
          }
        }
      }
    }
  }, 
  "DefaultPools": {
    "DEFAULT": {
      "Flags": [], 
      "PreferredBlockSize": 67108864, 
      "Blocks": {
        "1": {
          "TotalBytes": 67108864, 
          "UnusedBytes": 0, 
          "Allocations": 31, 
          "UnusedRanges": 0, 
          "Suballocations": [
            {"Offset": 0, "Type": "TEXTURE2D", "Size": 8388608, "Usage": 0}, 
            {"Offset": 8388608, "Type": "TEXTURE2D", "Size": 4194304, "Usage": 0}, 
            {"Offset": 12582912, "Type": "TEXTURE2D", "Size": 8847360, "Usage": 0}, 
            {"Offset": 21430272, "Type": "TEXTURE2D", "Size": 6422528, "Usage": 1}, 
            {"Offset": 27852800, "Type": "TEXTURE2D", "Size": 4849664, "Usage": 1}, 
            {"Offset": 32702464, "Type": "TEXTURE2D", "Size": 4849664, "Usage": 1}, 
            {"Offset": 37552128, "Type": "TEXTURE2D", "Size": 1441792, "Usage": 1}, 
            {"Offset": 38993920, "Type": "TEXTURE2D", "Size": 1441792, "Usage": 1}, 
            {"Offset": 40435712, "Type": "TEXTURE2D", "Size": 2621440, "Usage": 4}, 
            {"Offset": 43057152, "Type": "TEXTURE2D", "Size": 1310720, "Usage": 4}, 
            {"Offset": 44367872, "Type": "TEXTURE2D", "Size": 2621440, "Usage": 4}, 
            {"Offset": 46989312, "Type": "TEXTURE2D", "Size": 1310720, "Usage": 4}, 
            {"Offset": 48300032, "Type": "TEXTURE2D", "Size": 2621440, "Usage": 4}, 
            {"Offset": 50921472, "Type": "TEXTURE2D", "Size": 917504, "Usage": 1}, 
            {"Offset": 51838976, "Type": "TEXTURE2D", "Size": 917504, "Usage": 1}, 
            {"Offset": 52756480, "Type": "TEXTURE2D", "Size": 917504, "Usage": 1}, 
            {"Offset": 53673984, "Type":
2592 00:03:12.707657 ERROR edd5 [] C:\BuildAgent\work\fd76be73d7b9a640\src\tlib\gfx\d3d12\commond3d12.h(81): in "d3dCallImpl()": D3D is of memory, see the log for details

This is not really Lua stack, but it is engine level error indicating some meory allocation failed which is already interesting. Combining this with Lua stack would be perfect :)

FlorentP42 commented 1 month ago

Also I opened https://github.com/Teardown-Issue-Tracker-Maintainers/Teardown-Issue-Tracker/issues/567 regarding the crash above, this does not seem right :p