urho3d/urho3d

Segfault on SetModel in headless mode

ProtonPunk opened this issue · 4 comments

Trying to load and set Model or GetResource results in SegFault when there is no window open.

I'm seeing this migrating from 1.7 to latest w/ my headless server app. This works on 1.8-tag but not on master (df3d93c). I'm willing to find the commit which introduced it if needed.

How to reproduce: rake new [crash,tmpdir].
Create Setup func in .h and in .cpp use void crash::Setup() { engineParameters_ ["Headless"] = true; }.

// This line will segfault when there is no window
object->SetModel(cache->GetResource<Model>("Models/Mushroom.mdl"));
[Tue Jul 19 21:17:06 2022] INFO: Initialized engine
[Tue Jul 19 21:17:06 2022] DEBUG: Loading resource Models/Mushroom.mdl

Thread 1 "rep-server" received signal SIGSEGV, Segmentation fault.
__memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:416
416     ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
(gdb) bt
#0  __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:416
#1  0x00007ffff7a3d35e in __GI__IO_file_xsgetn (fp=0xda8870, data=<optimized out>, n=50640) at fileops.c:1304
#2  0x00007ffff7a30ee3 in __GI__IO_fread (buf=0x0, size=50640, count=1, fp=0xda8870) at iofread.c:38
1vanK commented

I'm willing to find the commit which introduced it if needed.

It would help a lot

@ProtonPunk Try version before this commit:
653d12f
It looks somewhat relevant.

1vanK commented

I think this caused by #2885

Error in

bool Model::BeginLoad(Deserializer& source)
{
   ...
            void* dest = buffer->Lock(0, desc.vertexCount_);

This return null because gapi == GAPI_NONE in headless mode

1vanK commented

Reopen this issue if the problem remains