Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game crashes if crashed train with reserved cargo vanishes #5570

Closed
DorpsGek opened this issue Jun 1, 2013 · 4 comments
Closed

Game crashes if crashed train with reserved cargo vanishes #5570

DorpsGek opened this issue Jun 1, 2013 · 4 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Jun 1, 2013

mfb opened the ticket and wrote:

The game crashes as soon as the crashed train at "Del Bonita Transfer" vanishes. This is fully reproducible and happens if you run the attached savegame for a few more days. It is related to the 5 tons of cargo this train reserved to load - if I skip the load order for the crashed train, the game does not crash any more.

From crash.log: Assertion failed at line 153 of ..\src\cargoaction.cpp: cp_new->Count() <= this->destination->reserved_count

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5570
@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 1, 2013

Mazur wrote:

The log-part as posted by V453000:

[1;31mError: Assertion failed at line 153 of /home/openttd/svn-publicserver/src/cargoaction.cpp: cp_new->Count() <= this->destination->reserved_count�[0;39m
Crash encountered, generating crash log...
*** OpenTTD Crash Report ***

Crash at: Sat Jun 1 18:55:01 2013
In game date: 2273-05-27 (61)

Crash reason:
Signal: Aborted (6)
Message: Assertion failed at line 153 of /home/openttd/svn-publicserver/src/cargoaction.cpp: cp_new->Count() <= this->destination->reserved_count

OpenTTD version:
Version: r25300 (2)
NewGRF ver: 140062d4
Bits: 32
Endian: little
Dedicated: no
Build date: May 29 2013 14:38:01

Stacktrace:
[00] ./publicserver(_ZNK12CrashLogUnix13LogStacktraceEPcPKc+0x43) [0x8325013]
[01] ./publicserver(_ZNK8CrashLog12FillCrashLogEPcPKc+0x102) [0x81d1382]
[02] ./publicserver(_ZNK8CrashLog12MakeCrashLogEv+0x9c) [0x81d14ac]
[03] ./publicserver [0x8324f46]
[04] [0xb775b400]
[05] [0xb775b424]
[06] /lib/i686/cmov/libc.so.6(gsignal+0x50) [0xb7324640]
[07] /lib/i686/cmov/libc.so.6(abort+0x188) [0xb7326018]
[08] ./publicserver [0x83103ae]

Operating system:
Name: Linux
Release: 2.6.32-bpo.5-686
Version: # 1 SMP Fri Jun 11 22:20:29 UTC 2010
Machine: i686
Compiler: GCC 4.3.2 "4.3.2"

Configuration:
Blitter: 8bpp-optimized
Graphics set: zBase (250)
Language: /home/openttd/svn-public/autopilot/lang/english.lng
Music driver: null
Music set: Scott Joplin Anthology (2)
Network: server
Sound driver: null
Sound set: OpenSFX (87)
Video driver: dedicated

AI Configuration (local: 255):
0: Human

Libraries:
FontConfig: 2.6.0
FreeType: 2.3.7
LZMA: 4.999.9beta
LZO: 2.03
PNG: 1.2.27
SDL: 1.2.12
Zlib: 1.2.3.3


This comment was imported from FlySpray: https://bugs.openttd.org/task/5570#comment12262

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 1, 2013

mfb wrote:

Something went wrong with the attached files. I don't see them, or the upload failed.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5570#comment12263

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 3, 2013

fonsinchen wrote:

This patch fixes it. There are several problems with the way vehicles are created and destroyed.

  1. Most of the fields of Vehicle aren't initialized in the constructor. Among them is last_station_visited. last_station_visited will most of the time be 0 then, which is a valid station. For vehicles which are not the head of a consist it is never updated. I consider that a bad idea and so I've added some code to properly initialize it.

  2. When clearing a crashed train or road vehicle the parts of the consist are cleared from the back. However, for each one last_station_visited is checked in Vehicle::PreDestructor to see where the vehicle had last stopped. Obviously that is a bad idea. However, up to the introduction of reservations this hadn't done any harm as the bogus station would only be used to remove the vehicle from Station::loading_vehicles.

  3. With the introduction of cargo reservation the bogus station was also used to cancel reservations. Canceling reservations at a different station than the one where they were issued causes the above assertion error.

The solution for now is to just assign last_station_visited on the decoupled wagon in order to return cargo to the correct station. This is because the decoupled wagon becomes its own consist at the time of decoupling and should inherit its "parent"'s last_station_visited. Arguably most of the block starting at vehicle.cpp:725 is still at least misleading, though.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/5570#comment12270

@DorpsGek
Copy link
Member Author

DorpsGek commented Jun 4, 2013

Rubidium closed the ticket.

Reason for closing: Fixed

In r25319


This comment was imported from FlySpray: https://bugs.openttd.org/task/5570

@DorpsGek DorpsGek closed this as completed Jun 4, 2013
@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant