Incidencia #47580

FAIR ../server/generator/mapgen.c::3102]: assertion 'pftile2 != NULL' failed.

Abrir Fecha: 2023-03-15 19:08 Última actualización: 2024-02-09 15:36

Informador:
Propietario:
(Ninguno)
Tipo:
Estado:
Open
Componente:
Hito:
Prioridad:
5 - Medium
Gravedad:
9 - Highest
Resolución:
Ninguno
Fichero:
3

Details

3.0.6+ , compiled with clang14

I scripted randoms tests

I got this error at map generation time

2: Leopoldo II rules the Florentines.
2: Aditayaraj rules the Mons.
2: Antoine le Bon rules the Lorrains.
2: Creating a map of size 72 x 216 = 15552 tiles (16000 requested).
1: in fair_map_island_new() [../../../server/generator/mapgen.c::3088]: assertion '!fair_map_tile_border(pisland, pftile, sea_around_island)' failed.
2: Backtrace:
2:     0: ../../build/server/freeciv-server(backtrace_print+0x30) [0x55f399a2e390]
2:     1: ../../build/server/freeciv-server(do_log+0xe3) [0x55f399a39293]
2:     2: ../../build/server/freeciv-server(fc_assert_fail+0x94) [0x55f399a39594]
2:     3: ../../build/server/freeciv-server(+0x660aeb) [0x55f399415aeb]
2:     4: ../../build/server/freeciv-server(+0x64d4a5) [0x55f3994024a5]
2:     5: ../../build/server/freeciv-server(map_fractal_generate+0x9ef) [0x55f3993fd1af]
2:     6: ../../build/server/freeciv-server(+0x5c4f46) [0x55f399379f46]
2:     7: ../../build/server/freeciv-server(srv_main+0x33c) [0x55f399378e5c]
2:     8: ../../build/server/freeciv-server(main+0x10a6) [0x55f399369a46]
2:     9: /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f5ed7a29d90]
2:    10: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f5ed7a29e40]
2:    11: ../../build/server/freeciv-server(_start+0x25) [0x55f39933ff75]
1: Please report this message at https://osdn.net/projects/freeciv/ticket/
2: Backtrace:
2:     0: ../../build/server/freeciv-server(backtrace_print+0x30) [0x55f399a2e390]
2:     1: ../../build/server/freeciv-server(do_log+0xe3) [0x55f399a39293]
2:     2: ../../build/server/freeciv-server(fc_assert_fail+0x159) [0x55f399a39659]
2:     3: ../../build/server/freeciv-server(+0x660aeb) [0x55f399415aeb]
2:     4: ../../build/server/freeciv-server(+0x64d4a5) [0x55f3994024a5]
2:     5: ../../build/server/freeciv-server(map_fractal_generate+0x9ef) [0x55f3993fd1af]
2:     6: ../../build/server/freeciv-server(+0x5c4f46) [0x55f399379f46]
2:     7: ../../build/server/freeciv-server(srv_main+0x33c) [0x55f399378e5c]
2:     8: ../../build/server/freeciv-server(main+0x10a6) [0x55f399369a46]
2:     9: /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7f5ed7a29d90]
2:    10: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7f5ed7a29e40]
2:    11: ../../build/server/freeciv-server(_start+0x25) [0x55f39933ff75]
1: in fair_map_island_new() [../../../server/generator/mapgen.c::3102]: assertion 'pftile2 != NULL' failed.

Nicely the script saves the loaded random parameters before start, so i have a saved game to reproduce the error

##### MAP #####
set topology WRAPY|ISO
set landmass 65
set size 16
set generator FAIR

set aifill 26

I attached the generated .serv file (note the end save / start) , and the saved "game" which gives the error 100% of time here. it was launched with

LANG=en ../../build/server/freeciv-server -p  $(shuf -i 32769-59999 -n 1)  -l serv.log -r  fc-20230315-103711.881003025.serv 2>&1 |tee  console.log

Ticket History (3/20 Histories)

2023-03-15 19:08 Updated by: alain_bkr
  • New Ticket "../server/generator/mapgen.c::3102]: assertion 'pftile2 != NULL' failed." created
2023-03-15 19:34 Updated by: alain_bkr
Comentario
assertion '!fair_map_tile_border(pisland, pftile, sea_around_island)' failed.

It seems to say it cannot generate island.

I think the landmass=65 is too high and/or aifill=26 is too high for mapsize=16

landmass=65 => There will be only one land with lakes and it is not possible to generate 2 islands , and even more impossible 26 islands.

It is like a 2D percolation problem of water inside material (is there a path from one border to the opposite one ?) Percolation occurs near 53 % if remember correctly.

2023-03-15 19:35 Updated by: alain_bkr
  • Details Updated
2023-03-15 19:55 Updated by: alain_bkr
Comentario

First idea for a quick fix :

"set generator FAIR" implies :

  • set landmass < 45 (maybe 40 if 1 pole is generated, and 35 for 2 poles)
  • set mapsize PLAYER (number of tiles per player 1-1000)

Maybe just half the given landmass parameter to transform 15-85 range to 15-42.5 (if someone says 85 he wants lots of land ...)

2023-03-15 20:10 Updated by: alain_bkr
  • Details Updated
2023-03-19 01:27 Updated by: cazfi
2023-03-23 22:01 Updated by: alain_bkr
  • Summary Updated
2023-03-24 05:37 Updated by: alain_bkr
Comentario

a tiny patch, just in order to exit , instead of continuing after the first assertion failure which gives GB of logs , and still no map.

it just replaces fc_assert by  fc_assert_exit in the 2 mentionned lines.

2023-03-24 23:29 Updated by: alain_bkr
  • Tipo Update from Bugs to Patches
2023-03-25 00:35 Updated by: alain_bkr
Comentario

Before the patch, when the generator fall in this case, it generated tons of logs (gigbytes)

The patch add an exit when this case occur.

I scripted a systematical test of the FAIR generator ,

Loop on  all the possible topologies,
 topology WRAPX|WRAPY|ISO|HEX
 topology WRAPX|WRAPY|HEX
 topology WRAPX|WRAPY|ISO
 topology WRAPX|WRAPY
 topology WRAPX|ISO|HEX
 topology WRAPX|HEX
 topology WRAPX|ISO
 topology WRAPX
 topology WRAPY|ISO|HEX
 topology WRAPY|HEX
 topology WRAPY|ISO
 topology WRAPY
 topology ISO|HEX
 topology HEX
 topology ISO
 topology ""

  loop on map size 4 64 256 1024 and 2048 
      loop on different number of AI 3 9 27 81 150
           generate a fair map

1/ The patch works : I had no more crazy loops and huge logs, just exit depending on the parameters.

2/ Verification in progress, it may take some time. WRAPY seems to cause trouble more often than others settings. It may be a "normal thing" due to the way the fair generator works , and happens when the conditions are met.

(Edited, 2023-03-25 01:55 Updated by: alain_bkr)
2023-04-02 10:14 Updated by: alain_bkr
Comentario

The patch works nicely , i had several exit, but no more loops of error messages.

With FAIR generator, WRAPY does not seem to work without WRAPX

I had some problems with huge maps (1024 or 2048) , or huge number of players , but this seems rather normal

2023-04-07 13:04 Updated by: cazfi
2023-06-03 16:08 Updated by: cazfi
Comentario

Reply To alain_bkr

The patch works nicely , i had several exit, but no more loops of error messages.

This still needs to be reworked to a solution that can be pushed in to the repository. Can't use fc_assert_exit()
- Server should not die completely, but to return to map generation loop at srv_ready() where it might retry with another seed
- Solution should not rely on asserts being enabled -> we want also non-debug builds to work

2023-06-30 21:08 Updated by: cazfi
2023-07-04 16:59 Updated by: alain_bkr
Comentario

I guess one can replace 'assert_exit' by 'if ... exit'

i am sorry, the current workflow ala 90's , with old tools and is just too annoying and inefficient.

I ll spend my effort on a github fork, with nice workflow, integrated bugreport, reactive people, documentation ...

good luck

(Edited, 2023-07-04 17:01 Updated by: alain_bkr)
2023-11-10 15:00 Updated by: cazfi
2024-02-09 15:36 Updated by: cazfi

Attachment File List

Editar

Please login to add comment to this ticket » Entrar