OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

[Bug] Switching route in quick succession would crash in the main menu

Open Kenny-Hui opened this issue 1 year ago • 15 comments

Description

Sometimes, switching between 2 routes very quickly in the main menu. (Easier done in the "Recently Used" tab) would cause an error. image

Reproduction

  1. Launch OpenBVE
  2. In the route tab, go to the "Recently Used" tab.
  3. Click 2 route in very quick succession
  4. Witness crash

Logs

OpenBVE Crash- 2023.7.30[21.25].log

Related information

  • Operating system: Debian 12 (Bullseye)
  • Method of control: Keyboard
  • OpenBVE Version: Latest Nightly Build

Kenny-Hui avatar Jul 30 '23 13:07 Kenny-Hui

Hmm...

I can't reproduce this at the minute. I'd suspect it's going to be timing related, and the fact that this is a pretty well specced machine doesn't help in that regard. The crash is being caused when it attempts to load the plugins, so I'm wondering if this is a thread timing issue. The commit may help.

leezer3 avatar Jul 30 '23 17:07 leezer3

Still the same crash on the latest Nightly build (I believe it is v1.7.1370.1061)

Kenny-Hui avatar Jul 31 '23 05:07 Kenny-Hui

Another tweak for the build from today.

I'm not absolutely convinced (the original code re-loaded the entire plugin stack) that this will be problem free, but see if that helps.

leezer3 avatar Aug 02 '23 16:08 leezer3

Interesting, the problem still exist under mono, but doesn't occur on Windows, so I think this is a mono specific issue?

Kenny-Hui avatar Aug 02 '23 17:08 Kenny-Hui

Probably but without reproducing it I don't know specifically. Unfortunately, the Mono forms implementation is (as I think you know) now essentially abandoned.

Not sure this is worth digging into too much further, especially as I can't reproduce :(

leezer3 avatar Aug 02 '23 17:08 leezer3

Probably not, or at least it seems to only happen on specific configuration and probably won't affect the masses.

I'll leave this issue opened just in case though.

Kenny-Hui avatar Aug 02 '23 18:08 Kenny-Hui

Didn't reproduce on my Ubuntu 20.04 + this version of mono. How about trying Debian 12's to this mono version to match?

user@20230802$ mono --version Mono JIT compiler version 6.12.0.200 (tarball Tue Jul 11 21:33:00 UTC 2023) Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com TLS: __thread SIGSEGV: altstack Notifications: epoll Architecture: amd64 Disabled: none Misc: softdebug Interpreter: yes LLVM: yes(610) Suspend: hybrid GC: sgen (concurrent by default)

ginga81 avatar Aug 03 '23 10:08 ginga81

Hmm I can reproduce this under Wine as well, now that's interesting, I don't think there's any specific configuration that could cause this.

Starting to think of if it's route related, I used a route with over 10K signal sections and it would take a good few second to load. But that doesn't explain why it won't crash on Windows as well

Kenny-Hui avatar Aug 03 '23 12:08 Kenny-Hui

I'd agree with the route related, but only in the sense it'll be hanging up the timing somewhere. Larger routes will be by definition slower to load & more prone.

10k signal sections is somewhat excessive, and I'm not surprised it causes slowdowns.

leezer3 avatar Aug 03 '23 13:08 leezer3

Nope it seems to happen regardless of route. After tinkering around, the only conclusion I can come up with is that I cancelled the route loading (switch route) before the all the content plugin could be fully loaded.

The same crash should also happen on Windows if you add something like a Thread.Sleep(2000) on LoadPlugins(). Why can I never get it to crash under normal circumstances is beyond me, maybe it's timing related.

Kenny-Hui avatar Aug 03 '23 13:08 Kenny-Hui

I think we should download and verify this TFO sample route to switch the exact same data to each other to reproduce the bug. Actually, there is no problem in my environment and leeser3's, only one person does not move, is it? https://bveworldwide.forumotion.com/t2301-animating-an-overtaking-train#21357 Conversely, it means that we can't reproduce it without sample data that causes the crash. At that point it ceases to be 'everything'.

ginga81 avatar Aug 03 '23 14:08 ginga81

Ok I've downloaded the TFO sample route and reproduced it under Wine 8.0.2

https://github.com/leezer3/OpenBVE/assets/28094366/c3504bd6-9c93-43e9-bf58-36d245de3e50

(Still the same crash log)

Kenny-Hui avatar Aug 05 '23 09:08 Kenny-Hui

The video was very helpful! When I switched the TFO sample route at the same speed, I got the same error as you, so I was able to reproduce it. You have to press it pretty quickly. I pushed it slowly.

ginga81 avatar Aug 05 '23 10:08 ginga81

Reproducible under Windows, just have to be really quick about it.

(Both hand, Mouse Click + Arrow Down immediately should be easier to reproduce)

Kenny-Hui avatar Aug 07 '23 18:08 Kenny-Hui

Still not at the minute :(

Will try a slower machine at some point, but that trigger is almost enough to ignore:/

leezer3 avatar Aug 07 '23 21:08 leezer3