The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: DrSuperGood on December 05, 2017, 02:41:50 AM

Title: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on December 05, 2017, 02:41:50 AM
I also occasionally see the long running doubly booked time slot bug (which was present back on the old server years ago).

There is a small chance that 2 or more convoys on the same line arriving at the same timetabled stop get assigned the same departure time slot meaning 2 or more convoys of that line will try to leave the stop at the same time rather than with the scheduled delay between them.

What triggers this is seemingly random. Sometimes it works correctly with the convoy arriving slightly later getting assigned the next time slot after the first convoy. Other times it bugs and both get assigned the same departure time slot.

Best way to recreate it is to assign timetabling at a bus/coach stop that a line uses in both directions. If it is working correctly then when 2 convoys arrive at the stop at the same time (one in each direction) they will both be allocated different departure times. Occasionally it can be observed that both are allocated the same departure time. If this occurs both convoys will leave in their appropriate direction at the same time.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Spenk009 on December 05, 2017, 07:38:58 AM
To add to this, in a similarly random/rare manner, if many convoys have the same departure time slot e.g. 0:48:00 due to timetabled stops they may ignore the next departure entirely and set to depart one timing cycle/instance later.

Typing this out, I realise that this may be within a line or global. The behavior appears as if there are too many convoys looking to depart at the same time and it can't book departure into that second/moment. I believe I see this behavior on reversing vehicles, usually in a departure window that follows a very common departure interval (i.e. 12cpm, 16cpm, 24cpm, 32cpm). I'd like to remind that not only do they start at 0:00:00, but also tend to meet at other times of the month 1:36:00, 3:12:00,... .

To avoid this behavior I delay the scheduled departure by a few seconds and this usually seems to avoid the issue.

I hope I'm not hijacking this thread.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on December 05, 2017, 11:27:28 PM
Dr. Supergood - thank you for the report. Are you able to upload s saved game in which this issue can reliably be reproduced at a specific point in time? Without this, it will be extremely difficult to track down the problem.

Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on December 23, 2017, 07:46:13 AM
Not sure if this is related to the original bug but it does seem to have similar symptoms. The line graphs show more departures than scheduled. It also seems extremely reliably stuck in this state.

The line is meant to have just 3 departures per month per stop (2 stops) for a total of 6 departures per month. The line stats are recording 12 departures per month. Either the convoys are leaving a lot sooner than they should or departures are being recorded twice per actual departure.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on December 23, 2017, 12:12:38 PM
Thank you for letting me know. I will look into this in January when I get back home, assuming that it can still be reproduced by then.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Jando on January 01, 2018, 11:15:10 PM
Hi James and others! Happy new year to you all!

I now have a saved game where this behaviour can be observed at a stop where it happens, saved game is here: http://files.simutrans.com/index.php/s/aYl3JEb1OKX6iTU

You see the bus stop Crabgate Hall with three departure points, one to the west, one to the east and one to the south. Departures to the west and east work as expected, departures to the south show the bug with two buses departing on the same time slot.

How to observe:
1. Load saved game.
2. Hit pause.
3. You see the stop with 5 buses already waiting and a 6th one is just arriving from the south. All lines are set to depart on the same time slot in this example, in about 9 minutes. Please ignore all other things, map is made just today to test passenger numbers, it's not a real game.
4. Unpause game and watch the buses at the southern departure point. You may want to hide the buildings for a better view. You will see the 2 buses to the south depart on the same time slot.
5. This seems to be consistent. The two buses will depart, go to the next town, turn around there and arrive closely after each other 2 time slots later where they again will depart on the same slot.

Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Jando on January 03, 2018, 01:22:33 PM
Here is a 2nd saved game where another schedule bug (but probably related that's why I post it in the same thread) can be observed: http://files.simutrans.com/index.php/s/o9LUWU6IOgzNblb

In this case it's not 2 buses leaving on the same time slot but a (horse) bus waiting for 2 time slots instead of for the next one, leaving the next time slot without departure.

How to observe:
1. Load saved game.
2  Hit pause.
3. Locate stop Stockinglock to the west and a little north of current position.
4. At Stockinglock you see a horse omnibus waiting for it's time slot and a 2nd omnibus waiting to pull into the stop. The stop is only served by one line and buses are scheduled to depart there every 17m27secs.
5. Unpause the game. Departure counter for bus at station will be around 10 minutes. 
6. With around 30 seconds left on the counter the omnibus will correctly start reversing (in doing so opening the stop for the already waiting 2nd horse omnibus).
7. This 2nd omnibus will however not wait for the next departure slot in about 17 minutes but instead wait for the departure slot after that one in 34 minutes.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on January 08, 2018, 01:29:33 PM
Splendid, thank you for reporting this. I think that I have now managed to fix it, which fix should be in the next nightly build. I should be grateful if you could re-test.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on April 15, 2018, 11:36:49 PM
Not fixed or maybe reverted...

Just seen this on the server game.

Additional details...

Image shows 2 different convoys at the same stop with the same departure time.

EDIT:
This is happening fairly frequently. When it does happen it always starts with a train arriving and suddenly being scheduled 2 slots ahead of the last scheduled train, skipping the time slot it is meant to use. When the next train arrives that train is scheduled in the same slot, which is its correct time slot. Hence the bug is that a train is randomly skipping a scheduled time slot for another one.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on April 16, 2018, 10:33:20 PM
Can I check whether this is reliably reproducable in the same place in the server game so that I can find a recurrence easily?
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on April 16, 2018, 11:44:34 PM
QuoteCan I check whether this is reliably reproducable in the same place in the server game so that I can find a recurrence easily?
Yes it occurs fairly frequently at one of my terminals on the server game. I watched on and off for about 1 in game month and it occurred 3-4 times.

The Terminal is Kelpike Terminal Station @5329,1294. It is serviced by 2 lines. The mail line is not a problem as only 1 convoy is there at any time. The problem is the passenger line which has a lot higher frequency.

For example when I logged into the server 2 trains were departing from it at the same time for the same line. They even had emergency stops in the junction due to the station signal.

In fact it occurs so much, that almost immediately after those 2 departed, another 2 also had the same problem where they were given a shared time slot. It is happening a lot at that terminal!
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Ves on April 18, 2018, 09:25:22 PM
This is also frequently happening at "Polditch Railway Station" at (1122,1152) on the servergame.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on May 03, 2018, 10:47:57 PM
Any update on fixing this? It makes running trains reliably very difficult.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on May 03, 2018, 11:16:33 PM
My apologies: bugs are currently being reported faster than I can fix them. One thing that might assist me to fix this more quickly would be a reproduction case on a much smaller saved game than the server game, as it is extremely difficult to work with the server game in a debug build as it is enormously unresponsive without optimisations.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Rollmaterial on May 03, 2018, 11:48:26 PM
My "Broken Time Interval" saves from my previous bug reports showcase this bug very frequently.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on May 04, 2018, 12:10:30 AM
Thank you - that is helpful. Can you indicate precisely where and when this can be observed in a specific one of these saved games?
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Rollmaterial on May 04, 2018, 01:13:30 AM
It can be seen at Fleckesmouth Road in Broken Time Interval 4, among others.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on May 05, 2018, 02:39:27 PM
Thank you for letting me know. It is not immediately apparent simply by looking at that saved game where this is occurring. Can you clarify on what line(s) and at what points in time that this can reliably be observed to occur?
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Rollmaterial on May 05, 2018, 02:48:47 PM
Line 2 does it at around 6:00:00 in July 1847.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on May 05, 2018, 06:42:35 PM
Thank you - that is helpful. I think that I have now fixed this: I should be grateful if you could re-test with the next nightly build.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on May 06, 2018, 06:04:23 AM
Not fixed. At least One of my train lines on the server game is still showing occasional double booked time slots. I have personally observed it twice.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on May 06, 2018, 04:12:04 PM
I am no longer able to reproduce this in the test game, so I will need a saved game in which this can reliably be reproduced at a specific time and place in order to fix this.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on May 06, 2018, 05:29:30 PM
I think it fixed some of the lines as I have not noticed the problem again on them. But one line still has it occurring occasionally (rarely?).
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on May 06, 2018, 08:25:09 PM
It may well be that what you now see is a different error causing similar symptoms (just as the error that has just been fixed is distinct from the error fixed in January, though its symptoms were similar). To fix this different error, I will need a saved game in which this can reliably be reproduced at a specific place and time.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on June 05, 2018, 08:04:39 PM
Have you been able to find a way of reproducing this reliably as yet?
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: DrSuperGood on June 05, 2018, 09:36:21 PM
No but I can confirm that it still exists.

On the server game I have been updating some of my train lines. Since the replacement tool is useless for replacing trains (as it does not count reversing assemblies the same as normal assemblies) this is done by withdrawing all active old trains and starting a whole lot of new trains from a depot at a terminal. Around the start of the repopulation of the line there almost always seems to be 1 or 2 trains that decide to use the same departure slot so leave at the same time.

Of course now that absolute block signals exist this is less of a problem as they only permit 1 train to enter the junction of a station at any time.

Except when they run into legacy time interval signals in which case they ignore the 5 or 10 minute wait time and decide to run at full speed through a danger time interval signal... But I guess that is another bug for another time.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on June 06, 2018, 11:20:50 PM
Thank you for letting me know. Unfortunately, without a way of reproducing this reliably at a specific time and place in a specific saved game, I have virtually no chance of being able to fix this.

As to the issue with the time interval signals, again, that has not been reported, and I will have no chance of fixing it without a full reproduction case.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: Matthew on June 11, 2018, 04:41:40 AM
James, you seem to have a very productive/leisurely weekend (I guess that debugging Simutrans counts as both!) and I'm grateful for your efforts. There seem to be improvements great and small.

I can't write C++, but I can file bug reports. Here's a reproducible example of double departure for you, playing with the nightly from 10 June (#65707af).

Steps to reproduce:
1. Open the save provided (https://app.box.com/s/pqcyqhzz8ei0baybsfunbi9ryxthm4hx).
2. Go to Polwich Railway Station (Polwich & Greeninglock Railway).
3. Around 6:00:00 in July 1912, you should see two convoys (368 and 369) from line "A1 Polwich-Perborough-Panton-Garden Coast Passenger Train" depart at the same time.
4. I tried reproducing it from the autosave at the start of July (https://app.box.com/s/jce47fw091us8mhf7zi0hkqw61fn4o01), but the game crashed near the end of the month (nothing to do with Simutrans; Windows Update started itself & ate up CPU). I hope to try again with the new (11 June) nightly.

(If it helps: The only change I can remember making to Polwich trains in July is scheduling line "A3 Larch Branch Passenger Train" to depart Polwich 12 times/month with a shift of about 10 minutes: you can see what I did in the step 1 save.)
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on June 17, 2018, 02:45:46 PM
Matthew - thank you for the report. Unfortunately, the saved game provided is too late in time, as the incorrect information (the departure time) is already encoded into both of the convoys (the waiting time can be seen in the convoy information windows). The error occurs when these data are first encoded: thereafter, the data are simply saved, and thus the actual problem cannot be reproduced at this point. What would be very helpful is if you (or anyone else) could reproduce a situation in which these incorrect timings come to be encoded in the first instance.
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: sinair285 on July 23, 2018, 04:06:30 PM
I think I can replicate the problem now.
I have a bus route that have two buses bunching at every loop of service (Departs at the same time when returning to the terminal) also.

The save game will send to James by inbox.  Hope it helps
Title: Re: Bug: Timetabled line double booking a single departure time slot.
Post by: jamespetts on August 04, 2018, 08:33:58 PM
Thank you for sending that. I have now had a chance to look in some detail at the saved game provided. The behaviour in this saved game is actually correct: one of the 'buses is set to "reverse route" wheras the others are not. By coincidence, the particular schedule that you have means that these 'buses will follow each other until Victoria stop, where they are timed. Because one is set to "reverse route" and the other is not, they are treated as if they are heading in opposite directions in the schedule, and thus do not wait for one another. This should not even be a problem in this particular situation, since they should be heading in opposite directions.
Edit: I have just run some tests to check whether the originally reported bug could occur at the end of a route with "reverse direction" enabled, but this does not appear to be the issue.