[BUG] Memory corruption
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
Issue description
The following example compiles but crashes randomly on Linux and windows
Reproducible example code
For the following constructor :
ScenarioPlayer::ScenarioPlayer(int hunger)
{
printf("\nConstructor1\n");
}
I used binder to build these bindings :
void bind_unknown_unknown(std::function< pybind11::module &(std::string const &namespace_) > &M)
{
{ // ScenarioPlayer file: line:35
pybind11::class_<ScenarioPlayer, std::shared_ptr<ScenarioPlayer>> cl(M(""), "ScenarioPlayer", "");
cl.def( pybind11::init<int>());
...
}
}
Result:
Running the following python code :
import pyplayerbase
print(ScenarioPlayer(1))
- On Windows it crashes randomly
- On Linux it always crashes, here the gdb stack trace:
gdb python3
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Registered pretty printers for UE4 classes
Reading symbols from python3...(no debugging symbols found)...done.
(gdb) r tests/scenarioplayer.py
Starting program: /usr/bin/python3 tests/scenarioplayer.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5dd1320 in ?? ()
(gdb) bt
#0 0x00007ffff5dd1320 in ?? ()
#1 0x00007ffff5f242be in ?? () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
#2 0x00007ffff5f25307 in pkgInitSystem(Configuration&, pkgSystem*&) () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.5.0
#3 0x00007ffff61c0e8f in ?? () from /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so
#4 0x000000000050a22f in ?? ()
#5 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#6 0x0000000000507cd4 in ?? ()
#7 0x0000000000516129 in ?? ()
#8 0x0000000000566ff2 in PyCFunction_Call ()
#9 0x0000000000510f56 in _PyEval_EvalFrameDefault ()
#10 0x0000000000507cd4 in ?? ()
#11 0x0000000000509a00 in ?? ()
#12 0x000000000050a3fd in ?? ()
#13 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#14 0x00000000005096c8 in ?? ()
#15 0x000000000050a3fd in ?? ()
#16 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#17 0x00000000005096c8 in ?? ()
#18 0x000000000050a3fd in ?? ()
#19 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#20 0x00000000005096c8 in ?? ()
#21 0x000000000050a3fd in ?? ()
#22 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#23 0x0000000000508dc5 in _PyFunction_FastCallDict ()
#24 0x00000000005a5481 in _PyObject_FastCallDict ()
#25 0x00000000005a64be in _PyObject_CallMethodIdObjArgs ()
#26 0x00000000004f6dbd in PyImport_ImportModuleLevelObject ()
#27 0x000000000050deee in _PyEval_EvalFrameDefault ()
#28 0x0000000000507cd4 in ?? ()
#29 0x0000000000516129 in ?? ()
#30 0x0000000000566ff2 in PyCFunction_Call ()
#31 0x0000000000510f56 in _PyEval_EvalFrameDefault ()
#32 0x0000000000507cd4 in ?? ()
#33 0x0000000000509a00 in ?? ()
#34 0x000000000050a3fd in ?? ()
#35 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#36 0x00000000005096c8 in ?? ()
#37 0x000000000050a3fd in ?? ()
#38 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#39 0x00000000005096c8 in ?? ()
#40 0x000000000050a3fd in ?? ()
#41 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#42 0x00000000005096c8 in ?? ()
#43 0x000000000050a3fd in ?? ()
#44 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#45 0x0000000000508dc5 in _PyFunction_FastCallDict ()
#46 0x00000000005a5481 in _PyObject_FastCallDict ()
#47 0x00000000005a64be in _PyObject_CallMethodIdObjArgs ()
#48 0x00000000004f6dbd in PyImport_ImportModuleLevelObject ()
#49 0x000000000050deee in _PyEval_EvalFrameDefault ()
#50 0x0000000000507cd4 in ?? ()
#51 0x0000000000516129 in ?? ()
#52 0x0000000000566ff2 in PyCFunction_Call ()
#53 0x0000000000510f56 in _PyEval_EvalFrameDefault ()
#54 0x0000000000507cd4 in ?? ()
#55 0x0000000000509a00 in ?? ()
---Type <return> to continue, or q <return> to quit---
#56 0x000000000050a3fd in ?? ()
#57 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#58 0x00000000005096c8 in ?? ()
#59 0x000000000050a3fd in ?? ()
#60 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#61 0x00000000005096c8 in ?? ()
#62 0x000000000050a3fd in ?? ()
#63 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#64 0x00000000005096c8 in ?? ()
#65 0x000000000050a3fd in ?? ()
#66 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#67 0x0000000000508dc5 in _PyFunction_FastCallDict ()
#68 0x00000000005a5481 in _PyObject_FastCallDict ()
#69 0x00000000005a64be in _PyObject_CallMethodIdObjArgs ()
#70 0x00000000004f6dbd in PyImport_ImportModuleLevelObject ()
#71 0x000000000050deee in _PyEval_EvalFrameDefault ()
#72 0x0000000000507cd4 in ?? ()
#73 0x0000000000516129 in ?? ()
#74 0x0000000000566ff2 in PyCFunction_Call ()
#75 0x0000000000510f56 in _PyEval_EvalFrameDefault ()
#76 0x0000000000507cd4 in ?? ()
#77 0x0000000000509a00 in ?? ()
#78 0x000000000050a3fd in ?? ()
#79 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#80 0x00000000005096c8 in ?? ()
#81 0x000000000050a3fd in ?? ()
#82 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#83 0x00000000005096c8 in ?? ()
#84 0x000000000050a3fd in ?? ()
#85 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#86 0x00000000005096c8 in ?? ()
#87 0x000000000050a3fd in ?? ()
#88 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#89 0x0000000000508dc5 in _PyFunction_FastCallDict ()
#90 0x00000000005a5481 in _PyObject_FastCallDict ()
#91 0x00000000005a64be in _PyObject_CallMethodIdObjArgs ()
#92 0x00000000004f6dbd in PyImport_ImportModuleLevelObject ()
#93 0x000000000050deee in _PyEval_EvalFrameDefault ()
#94 0x0000000000507cd4 in ?? ()
#95 0x0000000000516129 in ?? ()
#96 0x0000000000566ff2 in PyCFunction_Call ()
#97 0x0000000000510f56 in _PyEval_EvalFrameDefault ()
#98 0x0000000000507cd4 in ?? ()
#99 0x0000000000509a00 in ?? ()
#100 0x000000000050a3fd in ?? ()
#101 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#102 0x00000000005096c8 in ?? ()
#103 0x000000000050a3fd in ?? ()
#104 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#105 0x00000000005096c8 in ?? ()
#106 0x000000000050a3fd in ?? ()
#107 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#108 0x00000000005096c8 in ?? ()
#109 0x000000000050a3fd in ?? ()
#110 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#111 0x0000000000508dc5 in _PyFunction_FastCallDict ()
---Type <return> to continue, or q <return> to quit---
#112 0x00000000005a5481 in _PyObject_FastCallDict ()
#113 0x00000000005a64be in _PyObject_CallMethodIdObjArgs ()
#114 0x00000000004f6dbd in PyImport_ImportModuleLevelObject ()
#115 0x0000000000514174 in ?? ()
#116 0x0000000000566fb3 in PyCFunction_Call ()
#117 0x0000000000510f56 in _PyEval_EvalFrameDefault ()
#118 0x0000000000507cd4 in ?? ()
#119 0x0000000000509a00 in ?? ()
#120 0x000000000050a3fd in ?? ()
#121 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#122 0x00000000005096c8 in ?? ()
#123 0x000000000050a3fd in ?? ()
#124 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#125 0x0000000000508dc5 in _PyFunction_FastCallDict ()
#126 0x00000000005a5481 in _PyObject_FastCallDict ()
#127 0x00000000005a64be in _PyObject_CallMethodIdObjArgs ()
#128 0x00000000004f6dbd in PyImport_ImportModuleLevelObject ()
#129 0x000000000050deee in _PyEval_EvalFrameDefault ()
#130 0x0000000000508dc5 in _PyFunction_FastCallDict ()
#131 0x00000000005a5481 in _PyObject_FastCallDict ()
#132 0x000000000063870b in PyErr_PrintEx ()
#133 0x0000000000638af3 in PyRun_SimpleFileExFlags ()
#134 0x0000000000639671 in Py_Main ()
#135 0x00000000004b0e40 in main ()
(gdb)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked EnvironmentSimulator/Modules/PlayerBase/playerbase.cpp constructor and the binding in src/playerbase/pyplayerbase.cpp, then run the provided Python example under the reported Linux and Windows conditions. Compare the resulting crash with the supplied GDB trace and isolate whether the failure is in the binding or an external dependency. Done means ScenarioPlayer(1) can be instantiated without the reported crash and the cause is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100