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

[Crash]: YAPF: Trivial rail pathfinding crashes due to #12217 because ChooseRailTrack best node no longer always has a parent as currently required #12250

Closed
JGRennison opened this issue Mar 10, 2024 · 0 comments · Fixed by #12258

Comments

@JGRennison
Copy link
Contributor

Version of OpenTTD

Since #12217

Steps to reproduce

image
YapfGroup Ltd, 1990-01-16.sav.zip

Upload crash files

#0  CYapfFollowRailT<CYapfRail_TypesT<CYapfRail2, CFollowTrackT<(TransportType)0, Train, false, false>, CNodeList_HashTableT<CYapfRailNodeT<CYapfNodeKeyTrackDir>, 8, 10>, CYapfDestinationTileOrStationRailT, CYapfFollowRailT> >::ChooseRailTrack(Train const*, StrongType::Typedef<unsigned int, TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible<int>, StrongType::Compatible<long> >, DiagDirection, TrackBits, bool&, bool, PBSTileInfo*, StrongType::Typedef<unsigned int, TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible<int>, StrongType::Compatible<long> >*)
    (this=this@entry=0x7fff93a9fbd0, v=v@entry=0x55555785b780, path_found=@0x7fff93aa25d3: true, reserve_track=reserve_track@entry=true, target=target@entry=0x7fff93aa2610, dest=dest@entry=0x0)
    at /home/jgr/openttd/trunk/src/pathfinder/yapf/yapf_rail.cpp:451
#1  0x0000555555c173fd in CYapfFollowRailT<CYapfRail_TypesT<CYapfRail2, CFollowTrackT<(TransportType)0, Train, false, false>, CNodeList_HashTableT<CYapfRailNodeT<CYapfNodeKeyTrackDir>, 8, 10>, CYapfDestinationTileOrStationRailT, CYapfFollowRailT> >::stChooseRailTrack(Train const*, StrongType::Typedef<unsigned int, TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible<int>, StrongType::Compatible<long> >, DiagDirection, TrackBits, bool&, bool, PBSTileInfo*, StrongType::Typedef<unsigned int, TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible<int>, StrongType::Compatible<long> >*)
    (v=0x55555785b780, tile=..., enterdir=<optimised out>, tracks=<optimised out>, path_found=@0x7fff93aa25d3: true, reserve_track=<optimised out>, target=0x7fff93aa2610, dest=0x0)
    at /home/jgr/openttd/trunk/src/pathfinder/yapf/yapf_rail.cpp:405
#2  0x0000555555bfcbfb in YapfTrainChooseTrack(Train const*, StrongType::Typedef<unsigned int, TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible<int>, StrongType::Compatible<long> >, DiagDirection, TrackBits, bool&, bool, PBSTileInfo*, StrongType::Typedef<unsigned int, TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible<int>, StrongType::Compatible<long> >*)
    (v=v@entry=0x55555785b780, tile=..., enterdir=<optimised out>, tracks=tracks@entry=TRACK_BIT_Y, path_found=<optimised out>, reserve_track=reserve_track@entry=true, target=0x7fff93aa2610, dest=0x0)
    at /home/jgr/openttd/trunk/src/pathfinder/yapf/yapf_rail.cpp:546
#3  0x00005555560aa13f in DoTrainPathfind(Train const*, TileIndex, DiagDirection, TrackBits, bool&, bool, PBSTileInfo*, TileIndex*) (v=v@entry=0x55555785b780, tile=..., 
    tile@entry=..., enterdir=<optimised out>, tracks=tracks@entry=TRACK_BIT_Y, path_found=@0x7fff93aa25d3: true, do_track_reservation=do_track_reservation@entry=true, dest=<optimised out>, final_dest=<optimised out>)
    at /home/jgr/openttd/trunk/src/train_cmd.cpp:2480
#4  0x00005555560b3cf5 in ChooseTrainTrack(Train*, TileIndex, DiagDirection, TrackBits, bool, bool*, bool)
    (v=0x55555785b780, tile=..., enterdir=<optimised out>, tracks=<optimised out>, force_res=<optimised out>, got_reservation=0x7fff93aa26bf, mark_stuck=false) at /home/jgr/openttd/trunk/src/train_cmd.cpp:2815
#5  0x00005555560b4b39 in TryPathReserve(Train*, bool, bool) (first_tile_okay=<optimised out>, mark_as_stuck=false, v=0x55555785b780) at /home/jgr/openttd/trunk/src/train_cmd.cpp:2911
#6  TryPathReserve(Train*, bool, bool) (v=0x55555785b780, mark_as_stuck=<optimised out>, first_tile_okay=<optimised out>) at /home/jgr/openttd/trunk/src/train_cmd.cpp:2861
#7  0x00005555560b8ffb in CheckTrainStayInDepot (v=<optimised out>) at /home/jgr/openttd/trunk/src/train_cmd.cpp:2319
#8  TrainLocoHandler(Train*, bool) (v=v@entry=0x55555785b780, mode=mode@entry=false) at /home/jgr/openttd/trunk/src/train_cmd.cpp:3987
#9  0x00005555560b93f6 in TrainLocoHandler (mode=false, v=0x55555785b780) at /home/jgr/openttd/trunk/src/train_cmd.cpp:3943
#10 Train::Tick() (this=0x55555785b780) at /home/jgr/openttd/trunk/src/train_cmd.cpp:4120
#11 0x00005555560d5542 in CallVehicleTicks() () at /home/jgr/openttd/trunk/src/vehicle.cpp:1001
#12 0x0000555555f359ea in StateGameLoop() () at /home/jgr/openttd/trunk/src/openttd.cpp:1488
#13 0x0000555555f36b21 in GameLoop() () at /home/jgr/openttd/trunk/src/openttd.cpp:1609
#14 0x0000555555ccf2c2 in VideoDriver::GameLoop() (this=0x55555679c600) at /home/jgr/openttd/trunk/src/video/video_driver.cpp:39
#15 0x0000555555ccf363 in VideoDriver::GameThread() (this=0x55555679c600) at /home/jgr/openttd/trunk/src/video/video_driver.cpp:46
#16 0x0000555555cd1832 in StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}::operator()(char const*, void (*&&)(VideoDriver*), VideoDriver*&&) const (__closure=<optimised out>, A#0=<optimised out>, F=<optimised out>, name=0x55555618a726 "ottd:game") at /home/jgr/openttd/trunk/src/video/../thread.h:65
#17 std::__invoke_impl<void, StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*>(std::__invoke_other, StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&&&)(VideoDriver*), VideoDriver*&&)#1}, char const*&&, void (*&&)(VideoDriver*), VideoDriver*&&) (__f=<optimised out>) at /usr/include/c++/11/bits/invoke.h:61
#18 _ZSt8__invokeIZ14StartNewThreadIPFvP11VideoDriverEJS2_EEbPSt6threadPKcOT_DpOT0_EUlS8_OS4_OS2_E_JS8_S4_S2_EENSt15__invoke_resultIS9_JDpSB_EE4typeESA_SD_ (__fn=<optimised out>) at /usr/include/c++/11/bits/invoke.h:96
#19 std::thread::_Invoker<std::tuple<StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*> >::_M_invoke<0ul, 1ul, 2ul, 3ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul>) (this=<optimised out>) at /usr/include/c++/11/bits/std_thread.h:259
#20 std::thread::_Invoker<std::tuple<StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*> >::operator()() (this=<optimised out>) at /usr/include/c++/11/bits/std_thread.h:266
#21 std::thread::_State_impl<std::thread::_Invoker<std::tuple<StartNewThread<void (*)(VideoDriver*), VideoDriver*>(std::thread*, char const*, void (*&&)(VideoDriver*), VideoDriver*&&)::{lambda(char const*, void (*&&)(VideoDriver*), VideoDriver*&&)#1}, char const*, void (*)(VideoDriver*), VideoDriver*> > >::_M_run() (this=0x55555792ec50) at /usr/include/c++/11/bits/std_thread.h:211
#22 0x00007ffff7364253 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
#23 0x00007ffff6fecac3 in start_thread (arg=<optimised out>) at ./nptl/pthread_create.c:442
#24 0x00007ffff707e850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
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

Successfully merging a pull request may close this issue.

1 participant