Skip to content

MallocCrash on Ubuntu with 4.20 when importing module #555

Closed
@slartibaartfast

Description

@slartibaartfast

Hi,
I can't figure out why importing some modules causes a crash.

The OS is Pop!_OS 18.04 LTS, and have also reproduced this on Ubuntu 18.04.
The UE4 version is 4.20
UnrealEnginePython branch is master.
Python version is 3.6.6

The system has been modified by adding a symlink /usr/include/python3.6/x86_64-linux-gnu/python3.6m/pyconfig.h which points to /usr/include/x86_64-linux-gnu/python3.6m/pyconfig.h, per issue #477

sudo ln -s /usr/include/x86_64-linux-gnu/python3.6m/pyconfig.h .

When working in the UE4 Editor, importing some modules, such as asyncio, causes a crash. It might only crash when importing a module that depends on a shared library. Running with gdb, the error looks like:

[2018.10.14-17.11.59:120][449]LogTemp: >>> import asyncio
free(): invalid pointer
Thread 1 "UE4Editor" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) continue
Continuing.
Signal 6 caught.
Malloc Size=131076 LargeMemoryPoolOffset=131092
CommonUnixCrashHandler: Signal=6
Malloc Size=65535 LargeMemoryPoolOffset=196655
Malloc Size=1312160 LargeMemoryPoolOffset=1508832
Malloc Size=68112 LargeMemoryPoolOffset=1576960
Malloc Size=145512 LargeMemoryPoolOffset=1722488
Realloc PtrSize=68112 NewSize=145512 PooledPtr=0x00007fff495605f0
Malloc Size=253872 LargeMemoryPoolOffset=1976384
Realloc PtrSize=145512 NewSize=253872 PooledPtr=0x00007fff49571010

Thread 1 "UE4Editor" received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff71a32b6 in FUnixPlatformMisc::DebugBreakInternal () at /home/trota/Code/UnrealEngine/Engine/Source/Runtime/Core/Private/Unix/UnixPlatformMisc.cpp:820
820 asm volatile("int $0x03");

The backtrace is available in this gist. Lines 17 through 20, and 223 look most relevant.

The python path looks like:

[2018.10.14-17.09.26:344][753]LogTemp: >>> import sys
[2018.10.14-17.09.31:936][424]LogTemp: >>> for p in sys.path:
[2018.10.14-17.09.37:528][ 95]LogTemp: ... print(p)
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: ../../../../../Documents/UnrealProjects/test420/Content/Scripts
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: ../../../../../Documents/UnrealProjects/test420/Plugins/UnrealEnginePython
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: ../../../../../Documents/UnrealProjects/test420/Content/ue_python.zip
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: /home/trota/Documents/UnrealProjects/test420
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: /usr/lib/python36.zip
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: /usr/lib/python3.6
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: /usr/lib/python3.6/lib-dynload
[2018.10.14-17.09.38:045][157]LogPython:
[2018.10.14-17.09.38:045][157]LogPython: /home/trota/.local/lib/python3.6/site-packages
[2018.10.14-17.09.38:046][157]LogPython:
[2018.10.14-17.09.38:046][157]LogPython: /usr/local/lib/python3.6/dist-packages
[2018.10.14-17.09.38:046][157]LogPython:
[2018.10.14-17.09.38:046][157]LogPython: /usr/lib/python3/dist-packages
[2018.10.14-17.09.38:046][157]LogPython:

Pip can see asyncio:

[2018.10.14-17.10.23:865][855]LogTemp: >>> import subprocess
[2018.10.14-17.11.14:041][586]LogTemp: >>> subprocess.check_call([sys.executable, '-m', 'pip', 'list'])
asn1crypto (0.24.0)
asyncio (3.4.3)
...

To reproduce this on an Ubuntu 18.04 or Pop!_OS 18.04 machine with Python3.6 and asyncio module:

  1. Clone and make UnrealEngine 4.20 by running ./Setup, ./GenerateProjectFiles.sh, and make
  2. Create a new C++ project
  3. Clone UnrealEnginePython into the new project's plugins directory
  4. Open the new project, let it compile the plugin
  5. Open the python console
  6. enter import asyncio

Is the problem that not all modules are being loaded into the dictionaries? I don't know how to work around this and would really appreciate any suggestions. Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions