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

truck got a non-existing cargo #6169

Closed
DorpsGek opened this issue Nov 12, 2014 · 5 comments
Closed

truck got a non-existing cargo #6169

DorpsGek opened this issue Nov 12, 2014 · 5 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

smhg opened the ticket and wrote:

Please have a look at the attached screenshot.
The information panel of the truck displays a cargo of 4,294,953,103 tonnes of wood.

The truck itself has orders to load and unload the same cargo at the same station. I am aware this is not a nice thing to do, but after a few rounds it suddenly got this huge cargo. While 3 other trucks doing the same orders behave normal.

I'm running version 1.4.4 on Ubuntu 14.10.

Please let me know if you need more information.

Attachments

Reported version: 1.4.4
Operating system: Linux


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

planetmaker wrote:

The game is from an unmodified 1.4.4 and will crash in trunk with
Message: Assertion failed at line 305 of /home/planetmaker/ottd/trunk/src/cargopacket.h: this->action_counts[MTA_KEEP] + this->action_counts[MTA_DELIVER] + this->action_counts[MTA_TRANSFER] + this->action_counts[MTA_LOAD] == this->count

Stacktrace:
[00] /home/planetmaker/ottd/trunk/bin/openttd(_ZNK12CrashLogUnix13LogStacktraceEPcPKc+0x37) [0x717047]
[01] /home/planetmaker/ottd/trunk/bin/openttd(_ZNK8CrashLog12FillCrashLogEPcPKc+0xeb) [0x6054cb]
[02] /home/planetmaker/ottd/trunk/bin/openttd(_ZNK8CrashLog12MakeCrashLogEv+0x48) [0x605708]
[03] /home/planetmaker/ottd/trunk/bin/openttd() [0x716f55]
[04] /lib64/libc.so.6(+0x358f0) [0x7ff964f6b8f0]
[05] /lib64/libc.so.6(gsignal+0x37) [0x7ff964f6b877]
[06] /lib64/libc.so.6(abort+0x148) [0x7ff964f6cf68]
[07] /home/planetmaker/ottd/trunk/bin/openttd() [0x704c88]
[08] /home/planetmaker/ottd/trunk/bin/openttd() [0x4e6fcc]
[09] /home/planetmaker/ottd/trunk/bin/openttd(_ZN16VehicleCargoList5StageEbt10SmallStackIttLt65535ELt8ELt65533EEhPK10GoodsEntryP12CargoPayment+0xc46) [0x5ed1c6]
[10] /home/planetmaker/ottd/trunk/bin/openttd(_Z13PrepareUnloadP7Vehicle+0x1fc) [0x6129dc]
[11] /home/planetmaker/ottd/trunk/bin/openttd(_ZN7Vehicle12BeginLoadingEv+0x258) [0x839228]
[12] /home/planetmaker/ottd/trunk/bin/openttd(Z31IndividualRoadVehicleControllerP11RoadVehiclePKS+0x1590) [0x761270]
[13] /home/planetmaker/ottd/trunk/bin/openttd(_ZN11RoadVehicle4TickEv+0x116) [0x7618a6]
[14] /home/planetmaker/ottd/trunk/bin/openttd(_Z16CallVehicleTicksv+0xbb) [0x837fab]
[15] /home/planetmaker/ottd/trunk/bin/openttd(_Z13StateGameLoopv+0x23f) [0x70711f]
[16] /home/planetmaker/ottd/trunk/bin/openttd(_Z8GameLoopv+0xf8) [0x707f28]
[17] /home/planetmaker/ottd/trunk/bin/openttd(_ZN15VideoDriver_SDL8MainLoopEv+0x204) [0x844474]
[18] /home/planetmaker/ottd/trunk/bin/openttd(_Z12openttd_mainiPPc+0x13d3) [0x706423]
[19] /lib64/libc.so.6(__libc_start_main+0xf5) [0x7ff964f57d65]
[20] /home/planetmaker/ottd/trunk/bin/openttd() [0x55b8ad]


This comment was imported from FlySpray: https://bugs.openttd.org/task/6169#comment13629

@DorpsGek
Copy link
Member Author

DorpsGek commented Jan 2, 2015

Rubidium wrote:

The issue planetmaker gets is because it got corrupted, mostly because stable releases do not perform all those sanity checks.

Besides that this issue bothers me a lot. I can't find a way where things do go wrong.
* the number is near-ish the value of 0 - 1 (actual about -14000), if only numbers >= 0 would be used (i.e. it is about 2 to the power of 32).
* in the savegame it is only 51343, but essentially it the same number (but with an underflow to 2 to the power of 16). But that's probably because only 16 bits are stored in the savegame.
* such an underflow implies that it must have happened with unloading, or a negative (or really huge) amount was loaded.
* the maximum amount to unload is the minimum of amount of cargo in the vehicle and the "load amount" (the amount to unload during gradual loading), which means the step may be at most 5 but no negative numbers are allowed since it is unsigned.
* the actual unloading works with only positive numbers and before doing anything it limits the amount to at most the amount of cargo and the load amount, i.e. the minimum of the amount of loaded cargo and the load amount.
* during loading something similar happens, only positive amounts and all bounded by load amount.

As such I'm not seeing how the values got so negative unless there has been a memory corruption somewhere, or a bug in some totally different location of the code that for some reason overwrites the data at this location.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6169#comment13688

@DorpsGek
Copy link
Member Author

andythenorth wrote:

Possible tar pit reproducing this? I've got a test game running, but the chances of rolling a dice and triggering this seem very low.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6169#comment14620

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) Vehicles labels Apr 7, 2018
@TrueBrain
Copy link
Member

Unable to reproduce; sorry, it seems we won't be able to fix this bug :(

@James103
Copy link
Contributor

Workaround: Send "Road Vehicle 3" belonging to "Titties Inc." to depot before it starts unloading at "Wroclaw Woods" station, south-eastern truck stop at (150, 394). Once the truck reaches the depot, sell it.

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

3 participants