openBVE crashes, another dependency issue?

Bug #990960 reported by Aidan Fell
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
openbve (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hi, when trying to load the Northern Line on openBVE it crashes with:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at OpenBve.Timetable.CollectData (OpenBve.Table& Table) [0x00000] in <filename unknown>:0
  at OpenBve.Timetable.CreateTimetable () [0x00000] in <filename unknown>:0
  at OpenBve.MainLoop.StartLoopEx (MainDialogResult result) [0x00000] in <filename unknown>:0
  at OpenBve.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at OpenBve.Timetable.CollectData (OpenBve.Table& Table) [0x00000] in <filename unknown>:0
  at OpenBve.Timetable.CreateTimetable () [0x00000] in <filename unknown>:0
  at OpenBve.MainLoop.StartLoopEx (MainDialogResult result) [0x00000] in <filename unknown>:0
  at OpenBve.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

Could this be another dependency issue.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: openbve 1.4.0.9-1
ProcVersionSignature: Ubuntu 3.2.0-24.37-generic 3.2.14
Uname: Linux 3.2.0-24-generic x86_64
NonfreeKernelModules: nvidia wl
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
Date: Sun Apr 29 09:21:04 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_GB:en
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: openbve
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Aidan Fell (islandmonkey) wrote :
Revision history for this message
Alessandro Menti (elgaton) wrote :

Not sure as the crash occurs in the Timetable management class, where no references to external libraries should be present.

I'll test this as soon as I can have access to a high bandwidth connection and upgrade my workstation to Precise (should be between the 2n and 3rd of May).

Revision history for this message
Aidan Fell (islandmonkey) wrote :

OK, thanks.

Revision history for this message
Aidan Fell (islandmonkey) wrote :

(continued from first comment)

I also had another crash:

System.NullReferenceException: Object reference not set to an instance of an object
  at System.Windows.Forms.ListView+ItemControl.ItemsMouseDown (System.Object sender, System.Windows.Forms.MouseEventArgs me) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.OnMouseDown (System.Windows.Forms.MouseEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WmLButtonDown (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ListView+ItemControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0
3d4e1c4

Revision history for this message
Alessandro Menti (elgaton) wrote :

I've tried loading the three Northern Line routes downloaded from <http://www.trainsimstuff.org/lu-northern-line/northern-line-downloads>; no errors occurred.

However, I noticed a strange behaviour: when running low on memory, OpenBVE tends to crash with "Divide by zero" exceptions (I actually experienced it once, when I set the VM to have only 512 MiB of RAM); maybe that's the cause.

I also checked the OpenBVE forums and found that some users, in the past, reported crashes on the Northern Line when using brakes: <http://openbve.freeforums.org/problem-using-northen-line-lt1995-t1291.html> (the forums are temporarily down, don't worry if you can't reach the thread just now). I actually tried to apply brakes to check the program's behaviour and experienced no crashes.

Could you please check:
1) whether you're working with the latest version of the Northern Line package, and
2) whether you've placed all the package files in the right place?

If yes, could you please attach a Mono backtrace? It would be helpful - open a Terminal and launch OpenBVE like this:
mono --debug /usr/lib/openbve/OpenBve.exe /filesystem=/etc/openbve/filesystem.cfg
Then try to reproduce the crash, the backtrace should be generated as soon as OpenBVE raises an exception; it should be displayed in the terminal or saved in a file into the directory OpenBVE was launched from (I could not find additional information about that). After that, please attach the backtrace here.

Also,
3) were you trying to applying brakes when OpenBVE crashed, and
4) how much memory have you got, and how much of it is free at the time you run OpenBVE (check it with the "top -n 1" command)?

Thanks for your help!

Changed in openbve (Ubuntu):
status: New → Incomplete
Revision history for this message
Paul Sladen (sladen) wrote :

Jamie: we really need to be able to reproduce this under a debugger. Would you be able to describe (for an idiot like me) the exact sequence of steps necessary. Preferably in command-line form so that they can be more easily replicated; eg. something like:

  1. sudo apt-get install openbve
  2. cd ~/somewhere
  3. wget somewhere/something.zip
  4. unzip asdf
  5. openbve
  6. click once on X, Y, Z
  7. crash occurs

At this stage we don't know (I think) if it's in Openbve itself, or in one of the general Mono libraries.

Revision history for this message
Aidan Fell (islandmonkey) wrote :

Alessandro:

No, it crashes when loading the route (I have the latest version) and the train (both also crash when used separately).

Also, I get no backtrace when loading OpenBVE up like that, just the crash.

I'll grab the memory amount and post it here in a minute (I won't tell you much with multiple processes running).

Paul:
1) Make sure you have the latest Northern Line package.
2) Launch OpenBVE.
3) Click on of the northern line routes.
4) Launch it.
5) It will probably crash.

Revision history for this message
Aidan Fell (islandmonkey) wrote :

Memory when OpenBVE is running:

1969456k

Revision history for this message
Paul Sladen (sladen) wrote :

James:

  (a) What is the *exact* Northern Line URL
  (b) What is the *exact* md5sum and byte size of the file /you/ downloaded
  (c) Which *exact* Northern Line route, and which *exact* Northern Line train?

Revision history for this message
Paul Sladen (sladen) wrote :

$ md5sum *.7z
0e877f5a78339e44254f4377b8b7b547 LT1995StockTrainOpenBVE.7z
dac219082078a9906cfcb507b3df067b NorthernLineObjectsOpenBVE.7z
b10abfc5723aa406be886bd23f2c6d51 NorthernLineRoutesOpenBVE.7z
9c6d85b0fe3a6a58274b2f7cc92118f7 NorthernLineSoundsOpenBVE.7z

$ mkdir ~/openbve && cd ~/openbve
$ for i in *.7z ; do 7z x $i ; done
$ ls -l Train/ Railway/

$ dpkg -l openbve | awk '/ii/{print $2,$3}'
openbve 1.4.0.9-1

$ openbve

Selecting 'Browse Manually' and the entries:

  ~/openbve/Railway/Route/Northern Line OpenBVE/1995TS routes/Edgware-Kennington via ChX 1998.csv
  ~/openbve/Train/LT1995_openbve

with that setting, I am *not* able to reproduce the crash.

Revision history for this message
Aidan Fell (islandmonkey) wrote :

1) It's up in Alessandro's comment.
2) Whuh? How do I get that?
3) The one from Alessandro's link shown above.

Revision history for this message
Paul Sladen (sladen) wrote :

Alessandro: have you been able to reproduce this? If so, what action(s) are necessary?

Revision history for this message
Alessandro Menti (elgaton) wrote :

Paul,
I have not been able to reproduce the bug yet (I followed your exact same procedure, starting from a fresh Ubuntu 12.04 VM with all updates, with these differences:
-I let OpenBVE select the train automatically instead of choosing it manually, but checking that LT1995 got selected;
-I tried loading all three routes of the Northern Line in the "1995TS routes" folder, restarting OpenBVE after each try).

I have looked more carefully at the Northern Line package and noticed that there are other three routes in the "1995TS routes visible prior train" folder (I'll try to repeat the test with them later).

Jamie:
1) Are you perhaps trying to load one of the routes in the "1995TS routes visible prior train" folder?
2) Which specific route is causing the crash?
3) Could you please check that the Northern Line package has been downloaded correctly? To check this, open a Terminal and issue these commands:
cd <directory where you downloaded the 7z files of the Northern Line>
md5sum LT1995StockTrainOpenBVE.7z NorthernLineObjectsOpenBVE.7z NorthernLineRoutesOpenBVE.7z NorthernLineSoundsOpenBVE.7z
The output should be (check carefully the first part of these lines):
0e877f5a78339e44254f4377b8b7b547 LT1995StockTrainOpenBVE.7z
dac219082078a9906cfcb507b3df067b NorthernLineObjectsOpenBVE.7z
b10abfc5723aa406be886bd23f2c6d51 NorthernLineRoutesOpenBVE.7z
9c6d85b0fe3a6a58274b2f7cc92118f7 NorthernLineSoundsOpenBVE.7z

Revision history for this message
Aidan Fell (islandmonkey) wrote :

1) No, I have never used that route type?
2) All. I also have additional issues trying to select the Edgware-Morden line, it crashes with this:

  at System.Windows.Forms.ListView+ItemControl.ItemsMouseDown (System.Object sender, System.Windows.Forms.MouseEventArgs me) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.OnMouseDown (System.Windows.Forms.MouseEventArgs e) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WmLButtonDown (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.ListView+ItemControl.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000] in <filename unknown>:0
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000] in <filename unknown>:0

3) I can't do that, to save space I deleted all the .7z files.

Revision history for this message
Paul Sladen (sladen) wrote :

Jamie: Thank you, please could you file the "Edgware-Morden" issue separately so that we don't get them mixed up. (We'll need the corresponding exact details of how to reproduce that too).

Jamie: Previously you stated "Click on of the northern line routes." Does it matter which one? Do you get the same result (crash) when testing each available route in turn. If it some happens with one/some, which one(s) cause the crash.

Is it necessary to move the train first, or does the crash/hang happen straight away without any keypresses. If you need to move the train first, which keys are you pressing in which order. Approximately how long after touching those sequence of keys does it take for Openbve on that particular route to crash/hang?

Revision history for this message
Aidan Fell (islandmonkey) wrote :

All routes crash, and they all do so at the splash screen.

Revision history for this message
Aidan Fell (islandmonkey) wrote :

Here is the other Edgware-Morden route bug:

https://bugs.launchpad.net/ubuntu/+source/openbve/+bug/995617

Revision history for this message
Aidan Fell (islandmonkey) wrote :

Any progress on this?

Revision history for this message
Aidan Fell (islandmonkey) wrote :

BTW, upgrading to latest version and the same thing happens (though different error):

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at OpenBve.Timetable.CollectData (OpenBve.Table& Table) [0x00000] in <filename unknown>:0
  at OpenBve.Timetable.CreateTimetable () [0x00000] in <filename unknown>:0
  at OpenBve.MainLoop.StartLoopEx (MainDialogResult result) [0x00000] in <filename unknown>:0
  at OpenBve.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at OpenBve.Timetable.CollectData (OpenBve.Table& Table) [0x00000] in <filename unknown>:0
  at OpenBve.Timetable.CreateTimetable () [0x00000] in <filename unknown>:0
  at OpenBve.MainLoop.StartLoopEx (MainDialogResult result) [0x00000] in <filename unknown>:0
  at OpenBve.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

Also I got this from the md5sum:

d282c34866b180a07a062dfbe389a90e openbve1420.7z

Revision history for this message
Alessandro Menti (elgaton) wrote :

I could not reproduce the bug before, I'll try with the new version (perhaps using the Visual Studio debugger on Windows might help if it's an OpenBVE code problem).

Revision history for this message
Aidan Fell (islandmonkey) wrote :

Did it work on Visual Studio?

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for openbve (Ubuntu) because there has been no activity for 60 days.]

Changed in openbve (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Alessandro Menti (elgaton) wrote :

Sorry for being late - my thesis got in the way... I'll try to reproduce this evening.

Changed in openbve (Ubuntu):
status: Expired → New
Revision history for this message
Alessandro Menti (elgaton) wrote :

I have built and run OpenBVE under Visual Studio, the only strange thing that happened was that OpenBVE was initially unable to load the ATS plugin as I forgot to copy it in the right place.

Just to make sure, could you please open a terminal and issue the command
sudo mkdir /usr/share/games/openbve/Data/Plugins
so that I can check if it's a "missing directory" issue? Thanks!

Changed in openbve (Ubuntu):
status: New → Incomplete
Revision history for this message
Henrik Pihl (ahvenas) wrote :

Alessandro Menti: That seemed to do the trick for me. No crashing for me when selecting a train/route.

Revision history for this message
Henrik Pihl (ahvenas) wrote :

Sorry for the misinformation, it seemed pretty stable for a while. I have had crashing only with selecting a route (sometimes it even works!), ok with selecting a train and steering it.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for openbve (Ubuntu) because there has been no activity for 60 days.]

Changed in openbve (Ubuntu):
status: Incomplete → Expired
Changed in openbve (Ubuntu):
status: Expired → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openbve (Ubuntu):
status: New → Confirmed
Revision history for this message
Tom Kapelko (tkapelko) wrote :
Download full text (6.8 KiB)

Hello,

Instead of creating another thread I decided to join this one.

Found a similar bug in Ubuntu 14.04, OpenBVE version 1.4.0.9-1 (have installed it using "aptitude")

Here is a complete crash report:

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Drawing.GDIPlus.GdipLoadImageFromFile (string,intptr&) <IL 0x0001c, 0xffffffff>
  at System.Drawing.Image.FromFile (string,bool) <IL 0x00029, 0x0005b>
  at System.Drawing.Image.FromFile (string) <IL 0x00002, 0x00013>
  at OpenBve.formMain.LoadImage (string,string) <IL 0x00014, 0x0003b>
  at OpenBve.formMain.formMain_Load (object,System.EventArgs) <IL 0x003a8, 0x00d83>
  at System.Windows.Forms.Form.OnLoad (System.EventArgs) <IL 0x00025, 0x00075>
  at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs) <IL 0x0002b, 0x0007f>
  at System.Windows.Forms.Form.OnCreateControl () <IL 0x0002d, 0x00053>
  at System.Windows.Forms.Control.CreateControl () <IL 0x000a4, 0x0011f>
  at System.Windows.Forms.Control.WmShowWindow (System.Windows.Forms.Message&) <IL 0x0003a, 0x00167>
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message&) <IL 0x001d1, 0x002d3>
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message&) <IL 0x00002, 0x0001b>
  at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message&) <IL 0x0003e, 0x0005b>
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message&) <IL 0x0015e, 0x00253>
  at System.Windows.Forms.Control/ControlWindowTarget.OnMessage (System.Windows.Forms.Message&) <IL 0x00007, 0x00025>
  at System.Windows.Forms.Control/ControlNativeWindow.WndProc (System.Windows.Forms.Message&) <IL 0x0000c, 0x00036>
  at System.Windows.Forms.NativeWindow.WndProc (intptr,System.Windows.Forms.Msg,intptr,intptr) <IL 0x00091, 0x00310>
  at System.Windows.Forms.XplatUIX11.SendMessage (intptr,System.Windows.Forms.Msg,intptr,intptr) <IL 0x000db, 0x003f3>
  at System.Windows.Forms.XplatUIX11.MapWindow (System.Windows.Forms.Hwnd,System.Windows.Forms.WindowType) <IL 0x00048, 0x001df>
  at System.Windows.Forms.XplatUIX11.CreateWindow (System.Windows.Forms.CreateParams) <IL 0x00575, 0x00bab>
  at System.Windows.Forms.XplatUI.CreateWindow (System.Windows.Forms.CreateParams) <IL 0x00006, 0x0001f>
  at System.Windows.Forms.NativeWindow.CreateHandle (System.Windows.Forms.CreateParams) <IL 0x00007, 0x0003f>
  at System.Windows.Forms.Control.CreateHandle () <IL 0x00041, 0x00069>
  at System.Windows.Forms.Form.CreateHandle () <IL 0x00001, 0x0002b>
  at System.Windows.Forms.Control.CreateControl () <IL 0x0004c, 0x00087>
  at System.Windows.Forms.Control.SetVisibleCore (bool) <IL 0x00044, 0x00083>
  at System.Windows.Forms.Form.SetVisibleCore (bool) <IL 0x0007d, 0x002ef>
  at System.Windows.Forms.Control.set_Visible (bool) <IL 0x0000e, 0x00032>
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control.set_Visible (bool) <IL 0x00039, 0xffffffff>
  at System.Windows.Forms.Application.RunLoop (bool,System.Windows.Forms.ApplicationContext) <IL 0x00060, 0x002fb>
  at System.Windows.Forms.Form.ShowDialog (System.Windows.Forms.IWin32Window) <IL 0x001fe, 0x008ab>
  at System.Windows.Forms.Form.Show...

Read more...

Revision history for this message
Tom Kapelko (tkapelko) wrote :

Sorry. Have forgotten to post an essential thing, that aforementioned crash occurs every time I try to launch OpenBVE, no special activities are required to reproduce error except just launching from a command line.

Revision history for this message
ludo33200 (ludo-cheron) wrote :

I think there a t least 3 problems reported here

Concerning the following problem
>System.NullReferenceException: Object reference not set to an instance of an object
> at System.Windows.Forms.ListView+ItemControl.ItemsMouseDown (System.Object sender, >System.Windows.Forms.MouseEventArgs me) [0x00000] in <filename unknown>:0

Other mentionned bugs should have been reported elsewhere for other bugs (duplicates ?)

Ubuntu 15.04
+ OpenBVE 1.4.0.9-1 as installed
I reproduce this bug each time i try to select a route with the mouse (not with the keyboard)

After having tried to localize the problem with monoDevelop, i think i've found something that could cause the problem

When i read the source code, i see
OpenBve/OldCode/formMain.Start.cs,

private void ShowRoute(bool UserSelectedEncoding) {
   if (Result.RouteFile != null) {
    this.Cursor = Cursors.WaitCursor;
    Application.DoEvents();
    ]...[

C# Microsoft documentation suggests this code (Application.DoEvent call ) could cause problems
https://msdn.microsoft.com/en-US/library/system.windows.forms.application.doevents%28v=vs.110%29.aspx
You will find many posts on many forums about this topic

>Calling this method causes the current thread to be suspended while all waiting window messages are processed. If a message >causes an event to be triggered, then other areas of your application code may execute. This can cause your application to >exhibit unexpected behaviors that are difficult to debug.

What i see is that removing this instruction (Application.DoEvent call) seems to remove the problem and allowing to show the route.
As i'm not a premium developper i'm not directly going to change the code for OpenBve.
If anyone could validate or not the code ??

---------- Code suggested
private void ShowRoute(bool UserSelectedEncoding) {
   if (Result.RouteFile != null) {
    this.Cursor = Cursors.WaitCursor;
    if (!Program.CurrentlyRunningOnMono) { // disabled code on Mono because it makes crash
     Application.DoEvents();
    }
                                ]...[

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.