Beta test the new forum at
Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[Crash] Game crash due to camera rotation

Started by Ranran, May 25, 2021, 04:28:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


The game always crashes when I rotate the camera a few times.
Can be reproduced with demo save.

This cannot be reproduced with at least the May 2 version (# 7289be5)


This turned out to crash in the same part as the crash bug I reported here. It's due to coomit d61a1a9bda0261a36d261c65090b4d6466427506.

A crash may occur even if you do not rotate the camera, but you can reproduce it 100% (in demo.sve) by rotating the camera.


I had forgotten to test whether my pull request works with "camera" rotation, for that I apologize. 

I am currently still trying to sort out what exactly the issue is, as the debugging information shows the system in in invalid state which is physically impossible to get into.  Furthermore, whenever a breakpoint is added to the karte_t::rotate90 function, the crash is unlikely to occur!  Valgrind also appears to reduce the likelihood of failure, however for the few failures I did capture, Valgrind showed no relevant issues.  This leads me to believe that some sort of race condition is occurring.  Defining NO_PRIVATE_CAR_DESTINATION_LINKING ( line 1975) appears to mitigate the problem, however I currently do not know whether it actually prevents the race condition, or just significantly decreases the likelihood of it.  I did make sure that the mutex protections were in all the same places as previously. 


Since experimental uses threading for route finding: Are all routefinding threads terminated before rotation?


As far as I can tell, the threads are terminated, but there is nothing to prevent them from starting again before the rotation in finished.  The same is true for the weg_t destructor function.

Nevermind, I found it in the sync-step function.


I found the issue, and the crash is cause by my code.  I had made an assumption that roads do not move in relation to one another.  It appears that private car routing never handled map rotation properly, it is just that my code caused a crash rather than cars getting lost.  I am trying to fix it now.  Again, I apologize for this.


I have submitted a pull request making the compression/linking tolerant of map rotation.  As it was before I came along, map rotation causes cars to become lost, hence the term "tolerant" despite preventing the crash from that particular issue entirely. 

For as to why the breakpoints prevented the issue, I am still not sure.  Is it possible that the breakpoints cause the map rotation to occurred between the find_route cycles (?!)... 

As neither network games, private car routing, nor regions (,20773.0.html) fully supported map rotation (as of me joining), has it become a depreciated?


The networkgames could support map rotation. However, it would rotate the map for all players at the same time. Hence it was disabled. One could think enabling map rotation when only one client is connected ...

The private car routing and regions are quite new.


Quote from: prissi on May 31, 2021, 01:31:03 AMOne could think enabling map rotation when only one client is connected ...
Please don't!
Playing on a rotated map can be quite confusing, and not being able to rotate it back unless there's only one player connected seems quite annoying to me.
So please don't enable the feature this way.