Facepunch / garrysmod-issues

Garry's Mod issue tracker
147 stars 56 forks source link

On x86-64, a not-found model path to ents.CreateClientProp(model) causes a crash because error.mdl can't be loaded #5798

Closed marchc1 closed 8 months ago

marchc1 commented 8 months ago

Details

Lua trace from one of the crashes:

Executable: C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\bin\win64\gmod.exe

-Lua Stack Traces-
==================
  Client
    0. SetModel - [C]:-1
      1. MakeEntityNone - lua/trackassembly/trackasmlib.lua:2103
        2. GetTransformOA - lua/trackassembly/trackasmlib.lua:2199
          3. RegisterPOA - lua/trackassembly/trackasmlib.lua:2236
            4. (null) - lua/autorun/trackassembly_init.lua:1686
              5. pcall - [C]:-1
                6. Record - lua/trackassembly/trackasmlib.lua:2964
                  7. ImportDSV - lua/trackassembly/trackasmlib.lua:3507
                    8. ProcessDSV - lua/trackassembly/trackasmlib.lua:3771
                      9. (null) - lua/weapons/gmod_tool/stools/trackassembly.lua:95
                        10. include - [C]:-1
                          11. (null) - gamemodes/sandbox/entities/weapons/gmod_tool/stool.lua:154
                            12. include - [C]:-1
                              13. (null) - gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua:372
                                14. include - [C]:-1
                                  15. (null) - gamemodes/sandbox/entities/weapons/gmod_tool/cl_init.lua:11

  Server
    Lua Interface = NULL

  MenuSystem
    *Not in Lua call OR Lua has panicked*

I currently don't have a solid way to reproduce the problem and am using this to store the information somewhere organized. I'll update it as I get more info

marchc1 commented 8 months ago

I finally have a way to replicate this:

marchc1 commented 8 months ago

Specifically, I crash when only having data/trackassembly/dsv/plarailtrackassembly_pieces.txt present, along with data/trackassembly/set/trackasmlib_dsv.txt

marchc1 commented 8 months ago

I think I've isolated the issue down to ents.CreateClientProp, because a simple

local c_Model = ents.CreateClientProp("models/this/isnt/going/to/load.mdl")

causes a crash.

image

marchc1 commented 8 months ago

On the NONE branch, this happens instead image

Seems to be purely an issue with x86-64, as both 32-bit and 64-bit will crash

marchc1 commented 8 months ago

For some reason, running ClientsideModel on an invalid path not only doesnt crash, but also causes ents.CreateClientProp calls with invalid paths to stop crashing as well?

marchc1 commented 8 months ago

Couple of other things to note, just summarizing from the development chat:

robotboy655 commented 8 months ago

It should be fixed now, thanks for all the details & work you did there.

dvdvideo1234 commented 7 months ago

Optimized on my side also @marchc1 https://github.com/dvdvideo1234/TrackAssemblyTool/commit/f42bdcfde3a7b8a843b1e4a4deea9660a0a1103c