The International Simutrans Forum

 

Author Topic: Bug in Just_in_Time=2 ?  (Read 3264 times)

0 Members and 1 Guest are viewing this topic.

Offline makie

  • Devotee
  • *
  • Posts: 208
    • Homepage PAK128-German
  • Languages: DE
Bug in Just_in_Time=2 ?
« 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.


   

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1389
Re: Bug in Just_in_Time=2 ?
« Reply #1 on: September 19, 2017, 07:20:20 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...

Offline makie

  • Devotee
  • *
  • Posts: 208
    • Homepage PAK128-German
  • Languages: DE
Re: Bug in Just_in_Time=2 ?
« Reply #2 on: December 10, 2017, 09:48:48 PM »
Tested with r8346
the Bug is a live and well

a real show stopper

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2833
  • Languages: EN
Re: Bug in Just_in_Time=2 ?
« Reply #3 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.

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1389
Re: Bug in Just_in_Time=2 ?
« Reply #4 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...

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2833
  • Languages: EN
Re: Bug in Just_in_Time=2 ?
« Reply #5 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.

Offline makie

  • Devotee
  • *
  • Posts: 208
    • Homepage PAK128-German
  • Languages: DE
Re: Bug in Just_in_Time=2 ?
« Reply #6 on: December 13, 2017, 03:08:16 PM »
Thanks
it looks good.

Tested with R8349.

I think the problem is solved.

Offline ampersand

  • Devotee
  • *
  • Posts: 127
  • Languages: EN, FR, PL
Re: Bug in Just_in_Time=2 ?
« Reply #7 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?

Offline makie

  • Devotee
  • *
  • Posts: 208
    • Homepage PAK128-German
  • Languages: DE
Re: Bug in Just_in_Time=2 ?
« Reply #8 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

Offline ampersand

  • Devotee
  • *
  • Posts: 127
  • Languages: EN, FR, PL
Re: Bug in Just_in_Time=2 ?
« Reply #9 on: February 17, 2020, 03:14:33 PM »
Right. =2 works fine with a new game or a savedreloaded with =2 set beforehand.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2833
  • Languages: EN
Re: Bug in Just_in_Time=2 ?
« Reply #10 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.