News:

Want to praise Simutrans?
Your feedback is important for us ;D.

BUG REPORT - Game freezes when using "smart hide objects"

Started by Arxidamos, October 03, 2017, 05:27:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Arxidamos

System specs
-> Intel Core i7 920 @ 2.67GHz
    12,0GB Triple-Channel DDR3 @ 534MHz
    2047MB NVIDIA GeForce GTX 660 (EVGA)
    MSI MSI X58 PLATINUM
    Realtek High Definition Audio
    111GB KINGSTON SVP200S37A120G ATA Device (SSD)
    Windows 7 64
    Other users have reported the game freezing. May be because of the same problem.

Simutrans version:
-> 120.2


Description
-> When using "smart hide objects", game freezes and never recovers. Then I have to close it.


How can this problem be reproduced?
-> When I play without "smart hide objects" it works fine. After I click this option,
   the game freezes after a few seconds.


Did you discover a workaround for the problem?
-> I found this on a forum.
   "There is now an option in Steam under betas for 'SDL_' this will load the SDL version of Simutrans
   on Windows. This may resolve issues for some users."
   The user reports it solved the problem but other problems occured.
   But I don't have and don't want a steam account.


Severity of the problem/urgency to fix it? (One of high, medium, low or a more detailed description)
-> High... For me at least...

Ters

You don't need Steam to get the SDL version of Simutrans. That is available on simutrans.com right next to the GDI version.

Leartin

You can use both GDI-Version and SDL-Version without steam.
https://www.simutrans.com/en/download/
Just don't get distracted by the large shiny "Download for Windows"-button, in the section "Other Platforms" you find both GDI and SDL Version for Windows. I'm not sure which version you are currently using, but since it seems graphics related, using the other one might fix the problem for you.

Arxidamos

#3
Well, I tried both GDI and SDL and still the same... It still freezes after a while. Without it everything seems to be working fine.

The only difference is that in the SDL version it takes longer before freezing. I don' t know if that means anything..

Ters

GDI/SDL are not really used for rendering the objects, so switching between them should not normally cure a freeze in the rendering to go away. On the other hand, I would not expect rendering to cause a freeze at all. Then again, there is some threading (of the bad upper-right quadrant type as I've been told) in there that might be enabled in the published builds.

TurfIt

Not sure what bad upper-right quadrant type threading is.... Google gets me IBS and alcoholic liver disease results...  Continuing smart hide trouble does indeed make me irritable, although hopefully not at that end, and does drive one to drink too much!

Can duplicate if I select "too many" threads. Looking at the code, immediately obvious where the race condition is, WTF was I thinking doing that?? But, how did this survive for 4 years? sigh.

Dwachs

I also observed strange behaviour with smart hiding: After enabled, the map was not drawn properly, lot of artefacts. I did not have time to look into this.
Parsley, sage, rosemary, and maggikraut.

Ters

Quote from: TurfIt on October 04, 2017, 01:00:10 AM
Not sure what bad upper-right quadrant type threading is....

It is something I've heard about at developer conferences recently. I could not find a name for the entire diagram, which has one axis of mutability and one axis of concurrency (or was it sharing or something like that), but the upper-right quadrant is apparently sometimes called the synchronization quadrant. That is where all the bad things happen. (The speaker, Kevlin Henney, is quite funny to listen to, although he makes serious points that make you feel guilty. And his talks are not just about threading, although some of them might be.)

Leartin


Ters

He has many speeches (and at least one book), and some elements are recycled. The one I saw last (mid-September) and that was fresh in my mind was called something about immutability.

prissi

Quote from: TurfIt on October 04, 2017, 01:00:10 AM
Can duplicate if I select "too many" threads. Looking at the code, immediately obvious where the race condition is, WTF was I thinking doing that?? But, how did this survive for 4 years? sigh.

May you enlight us with your findings ;)

Ters

It is an interesting mix of fun and frustration when a bug reports ticks in, and the problem is not understanding why it fails, as that turns out to be obvious (in hindsight at least), but how anything could possibly have been working for years.

TurfIt

Quote from: prissi on October 05, 2017, 07:53:17 AM
May you enlight us with your findings ;)
Wish I could. Must've been a fleeting thought or something as I have no idea what I was seeing.

However, discovered by accident replacing the cond_wait with a cond_timedwait doesn't freeze. (and the timer was never expiring). Bizarre. Or buggy pthread? or still buggy Simutrans? Don't know.
I did recently do a mingw upgrade which brought new versions of lots of libs incl. pthread, so am trusting nothing right now...

Also, changing the hiding_cond broadcast to before the mutex unlock also prevents the freeze. Also Bizarre. The broadcasting thread shouldn't need to be holding the condition mutex.

Perhaps someone else can try to replicate this?
For me, setting Simutrans to use 8 or 12 threads, on a 4 core / 8 thread CPU, and turning on the smart hide with radius 10 results in a freeze within 10 secs of mouse jiggling 95% of the time, and shortly thereafter for the rest. Making either of the changes above and no freeze for minutes at least.


Quote from: Dwachs on October 04, 2017, 05:23:58 AM
I also observed strange behaviour with smart hiding: After enabled, the map was not drawn properly, lot of artefacts. I did not have time to look into this.
Can you expand on this? I'm not seeing any issues here after the marking dirty fixes from ~18 months ago.

It is strange how trees are completely hidden around the mouse cursor, unless you have them already set to transparent, then the transparent trees remain... Perhaps that how those who actually use this feature want it?