The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Matthew on May 12, 2022, 04:20:24 PM

Title: [BUG] Reproducible client crash using the way direction overlay in B-B
Post by: Matthew on May 12, 2022, 04:20:24 PM
Steps to reproduce

1. Load this recent B-B save in current Extended (warning: file is >400MB).
2. At the spawn point, build a one-way road.
3. Use the colon : key to toggle the way direction overlay. Use the newly-built road to make sure that it is off.
4. Open the City List (Ctrl+T), select the Kernow region and go to Godwithers or jump to (560,1625).
5. Scroll around the city.
6. Find the incomplete motorway to the northeast of the city (545,1620). Scroll eastwards until Godwithers is out of view.
7. Turn on the way direction overlay.
8. Scroll along the motorway towards the west.


EDIT:
1. Download this minimal save. (https://drive.google.com/file/d/1n7BKh4oDryUGxuX6q0LkbhDELuBFSeKU/view?usp=sharing)
2. Jump to (65,135)
3. Turn on the way direction overlay.

Expected results

You see more of the map.

You see the way direction overlay.

Actual results

Client crash.

Backtrace

Glorious Technicolor version:
(https://i.imgur.com/3YRfy38.png)

Boring monotone version:
Thread 1 "simutrans-exten" received signal SIGSEGV, Segmentation fault.
0x0000555555745194 in roadsign_t::display_overlay(int, int) const ()
(gdb) bt
#0  0x0000555555745194 in roadsign_t::display_overlay(int, int) const ()
#1  0x00005555556f40a2 in objlist_t::display_obj_overlay(short, short) const ()
#2  0x00005555556d82c9 in grund_t::display_overlay(short, short) ()
#3  0x0000555555aca5de in planquadrat_t::display_overlay(short, short) const ()
#4  0x0000555555778472 in main_view_t::display(bool) ()
#5  0x0000555555aa8bf0 in intr_refresh_display(bool) ()
#6  0x0000555555b14ea4 in karte_t::sync_step(unsigned int, bool, bool) ()
#7  0x0000555555b3cad1 in karte_t::interactive(unsigned int) ()
#8  0x0000555555ab6a99 in simu_main(int, char**) ()
#9  0x0000555555b3fbc5 in sysmain(int, char**) ()
#10 0x00007ffff7804083 in __libc_start_main (main=0x55555567c0f0 <main>, argc=5, argv=0x7fffffffdee8, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffded8) at ../csu/libc-start.c:308
#11 0x000055555567c16e in _start ()
(gdb)

I will put a unoptimized debugged backtrace later.
Title: Re: [BUG] Reproducible client crash using the way direction overlay in B-B
Post by: Matthew on May 12, 2022, 07:21:18 PM
Debug backtrace


Glorious Technicolor version:
(https://i.imgur.com/hkXTu6o.png)

Boring monotone version:
Thread 1 "simutrans-exten" received signal SIGSEGV, Segmentation fault.
0x00005555556fbd51 in quickstone_tpl<convoi_t>::is_bound (this=<synthetic pointer>) at obj/../player/../tpl/quickstone_tpl.h:217
217             inline bool is_bound() const
(gdb) bt
#0  0x00005555556fbd51 in quickstone_tpl<convoi_t>::is_bound (this=<synthetic pointer>) at obj/../player/../tpl/quickstone_tpl.h:217
#1  roadsign_t::display_overlay (this=0x5555b93b2f90, xpos=-12, ypos=287) at obj/roadsign.cc:836
#2  0x00005555556b5a52 in objlist_t::display_obj_overlay (this=this@entry=0x5555b939f100, xpos=xpos@entry=-36, ypos=ypos@entry=284) at dataobj/objlist.cc:1298
#3  0x000055555569c53c in grund_t::display_overlay (this=this@entry=0x5555b939f0f8, xpos=xpos@entry=-36, ypos=ypos@entry=284) at boden/grund.cc:1836
#4  0x0000555555a2d1d0 in planquadrat_t::display_overlay (this=0x7ffeb3ab1958, xpos=<optimised out>, ypos=284) at simplan.cc:726
#5  0x000055555571c6db in main_view_t::display (this=0x555575822e70, force_dirty=force_dirty@entry=false) at display/simview.cc:290
#6  0x0000555555a1001b in intr_refresh_display (dirty=dirty@entry=false) at simintr.cc:78
#7  0x0000555555a7440e in karte_t::sync_step (this=this@entry=0x55557b6327d0, delta_t=<optimised out>, delta_t@entry=0, do_sync_step=do_sync_step@entry=false, display=display@entry=true) at simworld.cc:4943
#8  0x0000555555a916de in karte_t::interactive (this=this@entry=0x55557b6327d0, quit_month=quit_month@entry=2147483647) at simworld.cc:11348
#9  0x0000555555a1d83e in simu_main (argc=argc@entry=5, argv=argv@entry=0x7fffffffdee8) at simmain.cc:1693
#10 0x0000555555a9423d in sysmain (argc=5, argv=0x7fffffffdee8) at sys/simsys.cc:1102
#11 0x0000555555b17af6 in main (argc=<optimised out>, argv=<optimised out>) at sys/simsys_s2.cc:1014

Observations
This points to the problem being caused by the display of one-way signalling on railways, which fits as there are one-train-staff signals at the tiles that come into view when the client crashes.

Here is the track layout at those tiles:
(https://i.imgur.com/cgF3gff.png)

At this point, none of these tiles are reserved by a train.

The relevant line of the road signalling overlay was last changed by this commit (https://github.com/jamespetts/simutrans-extended/commit/b5032bec7a4eb3ce37a42fa5d1f11a8fa1292072). But it also involves the Quickstone template, which I do not yet understand at all.

EDIT: The save in the 'Steps to reproduce' reproduces roughly the same backtrace.

EDIT: I tried some different layouts, now in the save game above. Perhaps one-train-staff protection to the south causes the issue?

(https://i.imgur.com/fNRmmwC.png)
Title: Re: [BUG] Reproducible client crash using the way direction overlay in B-B
Post by: jamespetts on May 14, 2022, 05:12:07 PM
Thank you for this. I believe that I have now fixed this; I should be grateful if you could re-test with the next nightly build.
Title: Re: [BUG] Reproducible client crash using the way direction overlay in B-B
Post by: Matthew on May 15, 2022, 07:33:01 AM
Unfortunately it did not fix the problem; the client still crashes as before on the B-B map.

But it is not obvious to me which commit would have helped with this. There's a lot I don't know about Simutrans coding, so the problem is probably at my end, but perhaps you didn't actually push the relevant changes??
Title: Re: [BUG] Reproducible client crash using the way direction overlay in B-B
Post by: Matthew on May 15, 2022, 09:22:28 PM
Replying to this misplaced message (https://forum.simutrans.com/index.php?msg=200142):

I compiled a build with today's commit and it has fixed the problem. Thank you, James!
Title: Re: [BUG] Reproducible client crash using the way direction overlay in B-B
Post by: jamespetts on May 15, 2022, 09:39:30 PM
Quote from: Matthew on May 15, 2022, 09:22:28 PMReplying to this misplaced message (https://forum.simutrans.com/index.php?msg=200142):

I compiled a build with today's commit and it has fixed the problem. Thank you, James!
Oops - apologies for the misplaced message. I am not sure how that happened. Thank you for testing!