The International Simutrans Forum

Development => Patches & Projects => Topic started by: makie on September 19, 2017, 03:05:53 PM

Title: Bug in Just_in_Time=2 ?
Post by: makie on September 19, 2017, 03:05:53 PM
Save Game: http://makie.de/v9_b_m_1916_JIT2.sve

Simutrans 120.2.2 R8293
Linux openSUSE tumbleweed  64Bit
PAK128.german _10_3

Let the saved game running.
Look on the mill (Mühle (1898)) in the center.  The mill receive Weizen. The trains come an go. Some time the input storage get overload. Some times the input storage run empty. Let the game fast running. At 4. September maybe 12. Sept suddenly the input storage run empty and no new Weizen  was ordered. You can send the Train who waits for 100% load to the mill. This rest was used up. Then the mill work any more. The input storage stay empty for years, maybe for ever.

If You save this game with the dead mill, and then reload the mill start working again for some months until it die again.

This happen only with Just_in_Time=2 and it happened only if the input storage was overload sometimes.

I have seen this some times ago, with JiT2, the factory stands still for months or more, without recognizable reason. This is the first on, it stands still for ever and is reproducible.

(http://makie.de/Screenshot_Muehle.jpeg)
   
Title: Re: Bug in Just_in_Time=2 ?
Post by: TurfIt on September 19, 2017, 07:20:20 PM
Quote from: makie on September 19, 2017, 03:05:53 PM
and no new Weizen  was ordered.
I can't duplicate no wheat being ordered. I can duplicate it getting stuck with 209 on order as shown in your screenshot.
The supplying farm stops production after it expands with a new field. Save/reload the game restarts production.

Attached patch appears to fix. For DrSuperGood to continue as this is his logic...
Title: Re: Bug in Just_in_Time=2 ?
Post by: makie on December 10, 2017, 09:48:48 PM
Tested with r8346
the Bug is a live and well

a real show stopper
Title: Re: Bug in Just_in_Time=2 ?
Post by: DrSuperGood on December 11, 2017, 02:19:32 AM
I will look into this soon. I think I might know the cause as I did not consider farm production changes when caching state. In retrospect I think caching state was maybe a bad idea...

In server tests no one noticed this because the game is save/load cycled every time someone joins, which is quite frequently. The cache state is rebuilt on load, so gets corrected.
Title: Re: Bug in Just_in_Time=2 ?
Post by: TurfIt on December 11, 2017, 02:24:16 AM
The attached patch above should still be valid. I don't like stepping on others section of code, so didn't commit...
Title: Re: Bug in Just_in_Time=2 ?
Post by: DrSuperGood on December 11, 2017, 08:31:17 AM
I have hopefully commited a fix for this.

The factory code is really messy. One day I am going to have to go through it all yet a gain to clean it up and hopefully stop bugs like this from happening.
Title: Re: Bug in Just_in_Time=2 ?
Post by: makie on December 13, 2017, 03:08:16 PM
Thanks
it looks good.

Tested with R8349.

I think the problem is solved.
Title: Re: Bug in Just_in_Time=2 ?
Post by: ampersand on February 17, 2020, 01:15:32 PM
just observed it on 128.german with r8870: switched from just_in_time=1 to just_in_time=2 , then observed change in the factory report syntax, then all of the factories stopped ordering, drained down their storage to zero and just passangers cruised around.

What is the current state of this bug? Is it required to start the game over after changes to simuconf have been applied?
Title: Re: Bug in Just_in_Time=2 ?
Post by: makie on February 17, 2020, 01:30:32 PM
this bug here is fixed

but

there are some ?? funny ?? things

look here
https://forum.simutrans.com/index.php/topic,19014.msg180194.html

switch from 1 to 2 in a running game need some time and some save and load until normalization
Title: Re: Bug in Just_in_Time=2 ?
Post by: ampersand on February 17, 2020, 03:14:33 PM
Right. =2 works fine with a new game or a savedreloaded with =2 set beforehand.
Title: Re: Bug in Just_in_Time=2 ?
Post by: DrSuperGood on February 18, 2020, 12:49:05 AM
If changing from JIT1 to JIT2 in a running game, the game must be save/load cycled for it to work properly. This has always been the case.

There is no logic in Simutrans to deal with conversion when a setting is changed.
Title: Re: Bug in Just_in_Time=2 ?
Post by: prissi on January 31, 2021, 11:48:44 AM
Here is the patch from TurfIt updated to 9593. I have not tested it much. Would appreciate feedback.