News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Assertion failed when closing network game

Started by Dwachs, September 18, 2022, 12:53:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dwachs

CLosing the window of a running network game throws this:
sim-gitsvn: src/simutrans/utils/simrandom.cc:103: uint32 simrand(uint32): Assertion `(random_origin&INTERACTIVE_RANDOM) == 0' failed.

Thread 1 "sim-gitsvn" received signal SIGABRT, Aborted.
0x00007ffff6229cdb in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff6229cdb in raise () from /lib64/libc.so.6
#1  0x00007ffff622b375 in abort () from /lib64/libc.so.6
#2  0x00007ffff6221cda in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff6221d62 in __assert_fail () from /lib64/libc.so.6
#4  0x000000000074d970 in simrand (max=<optimized out>) at src/simutrans/utils/simrandom.cc:103
#5  0x0000000000704076 in haltestelle_t::fetch_goods (this=<optimized out>, load=..., good_category=<optimized out>,
    requested_amount=3, destination_halts=...) at src/simutrans/simhalt.cc:2094
#6  0x00000000007647b1 in vehicle_t::load_cargo (this=this@entry=0x63db710, halt=..., halt@entry=...,
    destination_halts=..., max_amount=<optimized out>) at src/simutrans/vehicle/vehicle.cc:181
#7  0x00000000006e85c9 in convoi_t::hat_gehalten (this=0x63db130, halt=...) at src/simutrans/simconvoi.cc:3026
#8  0x00000000006ff00e in haltestelle_t::request_loading (this=0x4a1b9a0, cnv=...) at src/simutrans/simhalt.cc:925
#9  0x00000000006e34f3 in convoi_t::laden (this=this@entry=0x63db130) at src/simutrans/simconvoi.cc:2828
#10 0x00000000006ed799 in convoi_t::step (this=0x63db130) at src/simutrans/simconvoi.cc:1193
#11 0x0000000000792af8 in karte_t::step (this=this@entry=0x4a5c330) at src/simutrans/world/simworld.cc:3248
#12 0x00000000007938a6 in karte_t::interactive (this=this@entry=0x4a5c330, quit_month=quit_month@entry=2147483647)
    at src/simutrans/world/simworld.cc:6177
#13 0x0000000000713e97 in simu_main (argc=argc@entry=9, argv=argv@entry=0x7fffffffdb88)
    at src/simutrans/simmain.cc:1677
#14 0x00000000007171a9 in sysmain (argc=9, argv=0x7fffffffdb88) at src/simutrans/sys/simsys.cc:1156
#15 0x00000000007dac54 in main (argc=<optimized out>, argv=<optimized out>) at src/simutrans/sys/simsys_s2.cc:1185

Parsley, sage, rosemary, and maggikraut.

Dwachs

same reason as in

https://forum.simutrans.com/index.php/topic,21928

INT_CHECK is called from somewhere, the quit-event is processed, which disables network mode. This prevents the random-mode to be reset in siminteraction, further down the assertion is triggered.

Honestly, I think calling check_events in sync_step is a bad idea.
Parsley, sage, rosemary, and maggikraut.

prissi

#2
Processing the events more frequently was necessary due to the broken way SDL handles finger events. Touching the screen fires between 50-100 identical event events (especially considering also the  useless floating point precision of my finger with at best 10 dpi compared to the integer values of an 8000 dpi mouse ... ) In the step, then often only once every second events were processed, making Simutrans unuseable.

So moving back is not really an option on weak devices like ARM.

EDIT: The quit event does call the quit tool in r10754, which is not safegame save and thus only executed in a step().

Dwachs

#3
The reason, why tool_quit was set to network-safe, was that quitting client will not send the quit command over network. Also in network games, no password should be needed to quit a game as client.

I did not test, but I suspect that with this change a clitting client will quit the server, too.

Edit: Tested. Closing the client sends a quit command to the server.
Parsley, sage, rosemary, and maggikraut.

Dwachs

I think we need another property for tools that prevents that they are send via network. This applies to quit, load/save functions.
Parsley, sage, rosemary, and maggikraut.

prissi

Setting the local flag for local only commands does the trick in r10758. Still need the proper tools for loading.

Dwachs

Thanks for looking into this. Sorry for bringing this up once more:

When closing the server window (with one client connected) still triggers the assertion for the server.
Parsley, sage, rosemary, and maggikraut.

Dwachs

Parsley, sage, rosemary, and maggikraut.