Coder Social home page Coder Social logo

ebadi / esmini-pybind11-dev3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pybind/cmake_example

1.0 1.0 2.0 1.07 MB

Example pybind11 module built with a CMake-based build system

License: Other

CMake 4.50% Python 1.05% C++ 93.45% Shell 0.91% Dockerfile 0.09%

esmini-pybind11-dev3's People

Contributors

ax3l avatar dean0x7d avatar ebadi avatar henryiii avatar sylvaincorlay avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

wangxinchd

esmini-pybind11-dev3's Issues

Memory corruption in pyplayerbase

git clone https://github.com/ebadi/esmini-pybind11.git  --recursive
cd esmini-pybind11
git clone https://github.com/ebadi/esmini.git
./prod-use-prebuilt-bindings.sh
LD_LIBRARY_PATH=$PWD/esmini/bin/:$LD_LIBRARY_PATH python3 tests/scenarioplayer.py

Version: 58bba6a

Ubuntu 20.04

test@test:~/esmini-pybind11$ LD_LIBRARY_PATH=$PWD/esmini/bin/:$LD_LIBRARY_PATH python3 tests/scenarioplayer.py
['AddObjectSensor', 'Frame', 'GetFixedTimestep', 'GetOSIFreq', 'GetParameterValue', 'IsQuitRequested', 'ScenarioFrame', 'SetFixedTimestep', 'SetOSIFileStatus', 'SetParameterValue', 'ShowObjectSensors', 'UpdateCSV_Log', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'callback', 'exe_path_', 'hunger', 'maxStepSize', 'minStepSize', 'name', 'opt', 'sensor']
malloc(): invalid size (unsorted)
Aborted (core dumped)
test@test:~/esmini-pybind11$ LD_LIBRARY_PATH=$PWD/esmini/bin/:$LD_LIBRARY_PATH gdb python3 tests/scenarioplayer.py
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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"...
Reading symbols from python3...
(No debugging symbols found in python3)
"/home/test/esmini-pybind11/tests/scenarioplayer.py" is not a core dump: file format not recognized
(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".
bt['AddObjectSensor', 'Frame', 'GetFixedTimestep', 'GetOSIFreq', 'GetParameterValue', 'IsQuitRequested', 'ScenarioFrame', 'SetFixedTimestep', 'SetOSIFileStatus', 'SetParameterValue', 'ShowObjectSensors', 'UpdateCSV_Log', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'callback', 'exe_path_', 'hunger', 'maxStepSize', 'minStepSize', 'name', 'opt', 'sensor']
malloc(): invalid size (unsorted)

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7de1859 in __GI_abort () at abort.c:79
#2  0x00007ffff7e4c3ee in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7f76285 "%s\n") at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007ffff7e5447c in malloc_printerr (str=str@entry=0x7ffff7f78a50 "malloc(): invalid size (unsorted)") at malloc.c:5347
#4  0x00007ffff7e57234 in _int_malloc (av=av@entry=0x7ffff7fa7b80 <main_arena>, bytes=bytes@entry=1024) at malloc.c:3736
#5  0x00007ffff7e592d4 in __GI___libc_malloc (bytes=1024) at malloc.c:3058
#6  0x00007ffff7e40e84 in __GI__IO_file_doallocate (fp=0x7ffff7fa86a0 <_IO_2_1_stdout_>) at filedoalloc.c:101
#7  0x00007ffff7e51050 in __GI__IO_doallocbuf (fp=fp@entry=0x7ffff7fa86a0 <_IO_2_1_stdout_>) at libioP.h:948
#8  0x00007ffff7e500b0 in _IO_new_file_overflow (f=0x7ffff7fa86a0 <_IO_2_1_stdout_>, ch=-1) at fileops.c:745
#9  0x00007ffff7e4e835 in _IO_new_file_xsputn (n=13, data=<optimized out>, f=<optimized out>) at libioP.h:948
#10 _IO_new_file_xsputn (f=0x7ffff7fa86a0 <_IO_2_1_stdout_>, data=<optimized out>, n=13) at fileops.c:1197
#11 0x00007ffff7e43678 in __GI__IO_puts (str=0x7ffff68f9b02 "\nConstructor1") at libioP.h:948
#12 0x00007ffff68e8742 in ScenarioPlayer::ScenarioPlayer() () from /home/test/.local/lib/python3.8/site-packages/pyplayerbase.cpython-38-x86_64-linux-gnu.so
#13 0x00007ffff68368a7 in ?? () from /home/test/.local/lib/python3.8/site-packages/pyplayerbase.cpython-38-x86_64-linux-gnu.so
#14 0x00007ffff684a7c0 in ?? () from /home/test/.local/lib/python3.8/site-packages/pyplayerbase.cpython-38-x86_64-linux-gnu.so
#15 0x00000000005f2fb9 in PyCFunction_Call ()
#16 0x00000000005f3446 in _PyObject_MakeTpCall ()
#17 0x000000000050aa4a in ?? ()
#18 0x00000000005f2b87 in PyObject_Call ()
#19 0x000000000059bc1c in ?? ()
#20 0x00000000005a6867 in ?? ()
#21 0x00007ffff68494eb in ?? () from /home/test/.local/lib/python3.8/site-packages/pyplayerbase.cpython-38-x86_64-linux-gnu.so
#22 0x00000000005f3446 in _PyObject_MakeTpCall ()
#23 0x000000000056f600 in _PyEval_EvalFrameDefault ()
#24 0x000000000056822a in _PyEval_EvalCodeWithName ()
#25 0x000000000068c1e7 in PyEval_EvalCode ()
#26 0x000000000067d5a1 in ?? ()
#27 0x000000000067d61f in ?? ()
#28 0x000000000067d6db in PyRun_FileExFlags ()
#29 0x000000000067da6e in PyRun_SimpleFileExFlags ()
#30 0x00000000006b6132 in Py_RunMain ()
#31 0x00000000006b64bd in Py_BytesMain ()
#32 0x00007ffff7de30b3 in __libc_start_main (main=0x4eec80 <main>, argc=2, argv=0x7fffffffdfd8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdfc8)
    at ../csu/libc-start.c:308
#33 0x00000000005f927e in _start ()

in Ubuntu 18.04:

wave@wave:~/repositories/esmini-pybind11$ LD_LIBRARY_PATH=$PWD/esmini/bin/:$LD_LIBRARY_PATH gdb python3 tests/scenarioplayer.py
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.
"/home/wave/repositories/esmini-pybind11/tests/scenarioplayer.py" is not a core dump: File format not recognized
(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".
['AddObjectSensor', 'Frame', 'GetFixedTimestep', 'GetOSIFreq', 'GetParameterValue', 'IsQuitRequested', 'ScenarioFrame', 'SetFixedTimestep', 'SetOSIFileStatus', 'SetParameterValue', 'ShowObjectSensors', 'UpdateCSV_Log', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'callback', 'exe_path_', 'hunger', 'maxStepSize', 'minStepSize', 'name', 'opt', 'sensor']

Constructor1

Constructor2
esmini GIT REV: eba5ae7
esmini GIT TAG: 
esmini GIT BRANCH: master
esmini BUILD VERSION: N/A - client build
Here 1 
Here 2
Here 3
Here 5
Here 6

Program received signal SIGSEGV, Segmentation fault.
_int_malloc (av=av@entry=0x7ffff7dcdc40 <main_arena>, bytes=bytes@entry=99776) at malloc.c:4110
4110	malloc.c: No such file or directory.
(gdb) bt
#0  _int_malloc (av=av@entry=0x7ffff7dcdc40 <main_arena>, bytes=bytes@entry=99776) at malloc.c:4110
#1  0x00007ffff7a791cc in __GI___libc_malloc (bytes=99776) at malloc.c:3067
#2  0x00007ffff3eb0298 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff61c3500 in ScenarioPlayer::Init() ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#4  0x00007ffff61c47b6 in ScenarioPlayer::ScenarioPlayer(int&, char**) ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#5  0x00007ffff61c4a65 in ScenarioPlayer::ScenarioPlayer() ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#6  0x00007ffff6119942 in ?? ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#7  0x00007ffff61299fd in ?? ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#8  0x0000000000566bec in _PyCFunction_FastCallDict ()
#9  0x0000000000595291 in ?? ()
#10 0x0000000000549ce5 in ?? ()
#11 0x0000000000551391 in ?? ()
#12 0x00007ffff61291c3 in ?? ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#13 0x00000000005a9d2c in _PyObject_FastCallKeywords ()
#14 0x000000000050a533 in ?? ()
#15 0x000000000050bf44 in _PyEval_EvalFrameDefault ()
#16 0x0000000000507cd4 in ?? ()
#17 0x000000000050ae13 in PyEval_EvalCode ()
#18 0x0000000000635262 in ?? ()
#19 0x0000000000635317 in PyRun_FileExFlags ()
#20 0x0000000000638acf in PyRun_SimpleFileExFlags ()
#21 0x0000000000639671 in Py_Main ()
#22 0x00000000004b0e40 in main ()
(gdb) 

pyesminilib.SE_Init : python3: malloc.c sysmalloc assertion

Execution of

import pyesminilib
from pyesminilib import *
fn = '/home/wave/repositories/esmini-pybind11/esmini/resources/xosc/lane_change.xosc'
pyesminilib.SE_Init(fn,1,0,0,0)

Results in:

~/repositories/esmini-pybind11$ gdb /usr/bin/python3.8 
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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 /usr/bin/python3.8...
(No debugging symbols found in /usr/bin/python3.8)
(gdb) r tests/esmini.py
Starting program: /usr/bin/python3.8 tests/esmini.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
esmini GIT REV: 06f0360+
esmini GIT TAG: 
esmini GIT BRANCH: undefined
esmini BUILD VERSION: N/A - client build
esminiLib.cpp / 104 / ConvertArguments(): Player arguments:  viewer --osc /home/wave/repositories/esmini-pybind11/esmini/resources/xosc/lane_change.xosc --headless --disable_controllers
esminiLib.cpp / 278 / InitScenario(): Done ConvertArguments
playerbase.cpp / 52 / ScenarioPlayer(): ScenarioPlayer::ScenarioPlayer
playerbase.cpp / 60 / ScenarioPlayer(): before Init
playerbase.cpp / 611 / Init(): inside Init
playerbase.cpp / 613 / Init(): after  string
playerbase.cpp / 620 / Init(): after IsCallbackSet checkx
python3.8: malloc.c:2379: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff7dd2859 in __GI_abort () at abort.c:79
#2  0x00007ffff7e4545a in __malloc_assert (
    assertion=assertion@entry=0x7ffff7f698a8 "(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)", file=file@entry=0x7ffff7f653c3 "malloc.c", line=line@entry=2379, function=function@entry=0x7ffff7f6a030 <__PRETTY_FUNCTION__.13066> "sysmalloc") at malloc.c:298
#3  0x00007ffff7e47abf in sysmalloc (nb=nb@entry=80, av=av@entry=0x7ffff7f98b80 <main_arena>) at malloc.c:2379
#4  0x00007ffff7e48913 in _int_malloc (av=av@entry=0x7ffff7f98b80 <main_arena>, bytes=bytes@entry=66) at malloc.c:4141
#5  0x00007ffff7e4a2d4 in __GI___libc_malloc (bytes=66) at malloc.c:3058
#6  0x00007ffff5113c29 in operator new(unsigned long) () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff59ce100 in ScenarioPlayer::Init() () from /home/wave/repositories/esmini-pybind11/esmini/bin/libesminiLib.so
#8  0x00007ffff59d1628 in ScenarioPlayer::ScenarioPlayer(int&, char**) () from /home/wave/repositories/esmini-pybind11/esmini/bin/libesminiLib.so
#9  0x00007ffff6e773ba in ?? () from /home/wave/.local/lib/python3.8/site-packages/pyesminilib.cpython-38-x86_64-linux-gnu.so
#10 0x00007ffff6e7873a in ?? () from /home/wave/.local/lib/python3.8/site-packages/pyesminilib.cpython-38-x86_64-linux-gnu.so
#11 0x00007ffff6e907ea in ?? () from /home/wave/.local/lib/python3.8/site-packages/pyesminilib.cpython-38-x86_64-linux-gnu.so
#12 0x00007ffff6e932ba in ?? () from /home/wave/.local/lib/python3.8/site-packages/pyesminilib.cpython-38-x86_64-linux-gnu.so
#13 0x00000000005f2fb9 in PyCFunction_Call ()
#14 0x00000000005f3446 in _PyObject_MakeTpCall ()
#15 0x000000000056f600 in _PyEval_EvalFrameDefault ()
#16 0x000000000056822a in _PyEval_EvalCodeWithName ()
#17 0x000000000068c1e7 in PyEval_EvalCode ()
#18 0x000000000067d5a1 in ?? ()
#19 0x000000000067d61f in ?? ()
#20 0x000000000067d6db in PyRun_FileExFlags ()
#21 0x000000000067da6e in PyRun_SimpleFileExFlags ()
#22 0x00000000006b6132 in Py_RunMain ()
#23 0x00000000006b64bd in Py_BytesMain ()
#24 0x00007ffff7dd40b3 in __libc_start_main (main=0x4eec80 <main>, argc=2, argv=0x7fffffffdea8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde98)
    at ../csu/libc-start.c:308
#25 0x00000000005f927e in _start ()
(gdb) 

The code executes crashes on opt.AddOptio()

int ScenarioPlayer::Init()
{
	std::string arg_str;
	// Use logger callback
	if (!(Logger::Inst().IsCallbackSet()))
	{
		Logger::Inst().SetCallback(log_callback);
	}
        LOG("after IsCallbackSet check");
        opt.AddOption("osc", "OpenSCENARIO filename - if path includes spaces, enclose with \"\" ", "filename");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.