Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScenarioPlayer destructor memory corruption #1

Open
ebadi opened this issue Dec 20, 2021 · 1 comment
Open

ScenarioPlayer destructor memory corruption #1

ebadi opened this issue Dec 20, 2021 · 1 comment

Comments

@ebadi
Copy link
Owner

ebadi commented Dec 20, 2021

This is probably because of incorrect translation of methods by pybind11.

import pyplayerbase
print("Start")
player = pyplayerbase.ScenarioPlayer(
    ["filename", "--window", "60", "60", "800", "400", "--osc", "./esmini/resources/xosc/cut-in.xosc"])
print("End")
$ python3 examples/test.py 
Start
B0_[ScenarioPlayer] 0:filename
1:--window
2:60
3:60
4:800
5:400
6:--osc
7:./esmini/resources/xosc/cut-in.xosc
esmini GIT REV: a75bb2b+
esmini GIT TAG: 
esmini GIT BRANCH: remotes/origin/fix_route_1st_waypoint_issue~1
esmini BUILD VERSION: N/A - client build
Generated seed 1064135184
Loading cut-in.xosc (v1.1)
OpenDRIVE: ../xodr/e6mini.xodr
Scenegraph: ../models/e6mini.osgb
Unsupported geo reference attr: +no_defs
Expr ${$EgoSpeed / 3.6} = 108 / 3.6 = 30.000000
0.000: Starting teleport Action
0.000: Ego New position:
0.000: Pos(8.17, 49.97, -0.04) Rot(1.57, 0.00, 0.00) roadId 0 laneId -3 offset 0.00 t -8.00
0.000: Init Ego TeleportAction standbyState -> startTransition -> runningState
0.000: Init Ego LongitudinalAction standbyState -> endTransition -> completeState
0.000: Starting teleport Action
0.000: OverTaker New position:
0.000: Pos(4.51, 24.98, -0.01) Rot(1.57, 0.00, 0.00) roadId 0 laneId -2 offset 0.00 t -4.42
0.000: Init OverTaker TeleportAction standbyState -> startTransition -> runningState
0.000: Init Ego TeleportAction runningState -> endTransition -> completeState
0.000: Init OverTaker TeleportAction runningState -> endTransition -> completeState
End
Closing
double free or corruption (!prev)
Aborted (core dumped)
(gdb) r examples/test.py
Starting program: /usr/bin/python3 examples/test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Start
B0_[ScenarioPlayer] 0:filename
1:--window
2:60
3:60
4:800
5:400
6:--osc
7:./esmini/resources/xosc/cut-in.xosc
esmini GIT REV: a75bb2b+
esmini GIT TAG: 
esmini GIT BRANCH: remotes/origin/fix_route_1st_waypoint_issue~1
esmini BUILD VERSION: N/A - client build
Generated seed 4108397888
Loading cut-in.xosc (v1.1)
OpenDRIVE: ../xodr/e6mini.xodr
Scenegraph: ../models/e6mini.osgb
Unsupported geo reference attr: +no_defs
Expr ${$EgoSpeed / 3.6} = 108 / 3.6 = 30.000000
0.000: Starting teleport Action
0.000: Ego New position:
0.000: Pos(8.17, 49.97, -0.04) Rot(1.57, 0.00, 0.00) roadId 0 laneId -3 offset 0.00 t -8.00
0.000: Init Ego TeleportAction standbyState -> startTransition -> runningState
0.000: Init Ego LongitudinalAction standbyState -> endTransition -> completeState
0.000: Starting teleport Action
0.000: OverTaker New position:
0.000: Pos(4.51, 24.98, -0.01) Rot(1.57, 0.00, 0.00) roadId 0 laneId -2 offset 0.00 t -4.42
0.000: Init OverTaker TeleportAction standbyState -> startTransition -> runningState
0.000: Init Ego TeleportAction runningState -> endTransition -> completeState
0.000: Init OverTaker TeleportAction runningState -> endTransition -> completeState
[New Thread 0x7fffef867700 (LWP 5436)]
[New Thread 0x7fffee1b9700 (LWP 5437)]
End
[Thread 0x7fffef867700 (LWP 5436) exited]
Closing
double free or corruption (!prev)

Thread 1 "python3" 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) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff7a22921 in __GI_abort () at abort.c:79
#2  0x00007ffff7a6b967 in __libc_message (action=action@entry=do_abort, 
    fmt=fmt@entry=0x7ffff7b98b0d "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff7a729da in malloc_printerr (
    str=str@entry=0x7ffff7b9a838 "double free or corruption (!prev)") at malloc.c:5342
#4  0x00007ffff7a79f7c in _int_free (have_lock=0, p=0xc1d870, av=0x7ffff7dcdc40 <main_arena>)
    at malloc.c:4311
#5  __GI___libc_free (mem=0xc1d880) at malloc.c:3134
#6  0x00007ffff4cdaa64 in ?? ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#7  0x00007ffff4ccbfa6 in ?? ()
   from /home/wave/.local/lib/python3.6/site-packages/pyplayerbase.cpython-36m-x86_64-linux-gnu.so
#8  0x0000000000573500 in ?? ()
#9  0x00000000005664a1 in ?? ()
#10 0x000000000056ec56 in PyDict_SetItem ()
#11 0x00000000004f30fc in PyImport_Cleanup ()
#12 0x0000000000637f6e in Py_FinalizeEx ()
#13 0x0000000000638fd5 in Py_Main ()
#14 0x00000000004b0d30 in main ()

@ebadi
Copy link
Owner Author

ebadi commented Dec 21, 2021

To partially resolve the issue, both pyscenarioengine and pyplayerbase have to be imported

import pyplayerbase
import pyscenarioengine

Results in:

End
<pyplayerbase.ScenarioPlayer object at 0x7f90c8ee7768>
Closing
double free or corruption (!prev)
Aborted (core dumped)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant