News:

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

Subtle bug triggered by replacer?

Started by neroden, June 03, 2013, 07:54:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neroden

I've been getting a subtle bug.  I've been attempting to use the replacer to replace a bunch of box boats with tub boats.  Using the "replace all" feature.  Most of them work.  However, some of the boats -- before being replaced -- get "stuck" in "Schedule changing" mode and I can't do anything with them.  They are always sitting at a station.  Then, eventually (at a new month, I think?) the game crashes.

The boats at this time are in a funny state.  They have "retire" on, they have "no load" on, they have "replacing" on, and they have no load... but they aren't heading for the depot.  If you push "go to depot", nothing happens.  You can get rid of them with the "sell" button.



S_N_C

For what it's worth, I've had vehicles get stuck in a "Schedule Changing!" state when I modify lines in Standard. Only way to get them out of it seems to be to use "Remove now!". Haven't noticed any crashing, but that could just be because the vehicles don't stick around a lot as a result  ;) Could it be the same bug, just triggered by the replacer?

Unfortunately I don't know how to reproduce it consistently.

neroden

Quote from: S_N_C on June 03, 2013, 08:05:19 PM
For what it's worth, I've had vehicles get stuck in a "Schedule Changing!" state when I modify lines in Standard. Only way to get them out of it seems to be to use "Remove now!". Haven't noticed any crashing, but that could just be because the vehicles don't stick around a lot as a result  ;)
Probably.  Doing the "sell"/"remove now" seems to avoid the crash.

QuoteCould it be the same bug, just triggered by the replacer?
Perhaps; it does sound similar, with a convoy stuck in "schedule changing" mode.  In this case, however, I haven't modified the line, I just started the replacer and waited.  So it could be different...

It would help to know what it means, internally in the code, when the convoi says "Schedule changing!"

QuoteUnfortunately I don't know how to reproduce it consistently.

Hmm.  I can't reproduce it consistently either.  It's very weird because it will happen to one convoy in a line and not to another convoy, even though they seem to be in the same state.  (It only happens to vehicles which were loaded at the time the replacer was run, but it only happens to SOME such vehicles.)

ӔO

this can happen if the depot is within the catchment zone of a dock the ship goes to.
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

jamespetts

Hmm, interesting. Catching the crash in a debugger will be a start to tracking down the problem, I think. From memory, "schedule changing" is the state when changes to a convoy's schedule are being propagated (I cannot remember precisely how), when the convoy is in effect locked for editing.

S_N_C's feedback is most useful: if the bug occurs in Standard, it might just be that Experimental's replacer triggers the conditions in which this occurs more often than would be the case in Standard; we know that we are not necessarily looking for the bug in Experimental specific code.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

neroden

#5
I'm debugging this.  There's an unpleasant little infinite loop involved.

---
I found it.  I'm still not quite sure how to fix it.  The problem arises when a convoi ends up with a bad home depot -- perhaps one which has been deleted.  When the replacer attempts to send the convoi to its home depot, it fails, and then goes into an infinite loop trying to insert it over and over again.

There are probably a lot of other subtle bugs caused by failed home depots.  It is probably best to run through the entire home depot code to clean it up, which I will try to do in the next couple of days.

neroden

Quote from: ӔO on June 03, 2013, 09:25:23 PM
this can happen if the depot is within the catchment zone of a dock the ship goes to.
As a "warmup", I fixed this bug (on my emergency-depot-bugfix branch).  The bug related to home_depot is a bit harder.

neroden

I fixed the main bug (and a couple of others which showed up).  This is on my emergency_depot_bugfix branch.