Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Caching/Seeding not working #3696

Open
1 task done
gioman opened this issue May 22, 2023 · 43 comments
Open
1 task done

[Bug]: Caching/Seeding not working #3696

gioman opened this issue May 22, 2023 · 43 comments
Labels

Comments

@gioman
Copy link
Contributor

gioman commented May 22, 2023

What is the bug?

Following te commands described in

https://docs.lizmap.com/current/en/admin/cache.html#seeding

the result is always

No layers configured with cache!

even if the project has indeed layers with server caching active.

This has been tested on a LMWC 3.6.3 installation made from scratch and as well on 3.6.3 upgraded from previous releases. To note that on 3.6.2 the seeding/wmts capabilities commands were returning errors, like the ones described here

https://lists.osgeo.org/pipermail/lizmap/2023-May/000647.html

The upgrade to 3.6.3 solved the errors, but seeding is not possible as the script do not seems to detect any layer with caching active.

Steps to reproduce the issue

See above.

Versions

LMWC 3.6.3, latest versions of Lizmap plugins.

Check Lizmap plugin

  • I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.

QGIS server version, only if the section above doesn't mention the QGIS Server version

3.28

Operating system

Ubuntu 22.04, desktop and server

Browsers

Firefox, Chrome

Browsers version

Latest

Relevant log output

No response

@gioman gioman added the bug label May 22, 2023
@nworr
Copy link
Contributor

nworr commented May 22, 2023

By default , the layer montpellier/Bus isn't configure to cache see

When testing the test project cache/bus


capabilities and seeding works as exepected

I manually set "cached" = "True" in the conf file, and the layer "Bus" was then able to cache , how did you enable server caching ?

However, the doc is quite confusing, the sample project file doesn't have any layer configured to allow cache.

@nworr nworr added the feedback label May 22, 2023
@gioman
Copy link
Contributor Author

gioman commented May 23, 2023

@nworr I'm not using the demo project. I have enabled server caching with the LM plugin (and caching is indeed enabled when navigating in LMWC).

@gioman
Copy link
Contributor Author

gioman commented May 31, 2023

Please remove the feedback label.

The CFG file is ok

image

but seeding scripts will always return

No layers configured with cache!

@nworr nworr removed the feedback label Jun 1, 2023
@nworr
Copy link
Contributor

nworr commented Jun 1, 2023

The dedicated test is working as expected : cypress end2end launch by github see results : test results .

Locally, i can't reproduce.

Does the wmts:capabilities command show some special output ?

@Gustry
Copy link
Member

Gustry commented Jun 1, 2023

Please share different commands you have launched and their outputs.

@gioman
Copy link
Contributor Author

gioman commented Jun 1, 2023

Please share different commands you have launched and their outputs.

@Gustry @nworr it seems to me that is another case of LMWC being finicky with layer names. As in #3660 it took me a few hours of troubleshooting to get to the conclusion.

  1. (always, not related to layer name) wmts:cacabilities never show for XYZ layers, for example added from the Browser or from a plugin like QuickMapservices

  2. If a layer/datasource is added in QGIS and its name has no spaces, and it is left unchanged in QGIS then it shows in wmts:cacabilities (the name given in LM plugin is not affecting this)

  3. if the layer/datasource name has spaces in it, then it never shows in wmts:cacabilities, regardless if the name is changed in QGIS project in order to replace spaces with something else, like "_".

  4. If the layer/datasource name has no spaces in it, but the name is changed to something else in QGIS with spaces, then it does not show in wmts:cacabilities

Having the possibility to at least have layer names with spaces and other stuff in QGIS project is important, because otherwise this has the effect to having to change it manually in at least two other places, LM plugin and the project print layouts legends.

@gioman gioman changed the title [Bug]: Seeding not working [Bug]: Seeding not working if layer/datasource names hava spaces in it Jun 1, 2023
@gioman
Copy link
Contributor Author

gioman commented Jun 1, 2023

More:

specifying tilematrix level 0 generates en error (even if level 0 is always shown as part of the wmts:capabilities of a layer)

php lizmap/console.php wmts:cache:seed -v -f reponame projname layername EPSG:3857 0 6
TileMatrixMin and TileMatrixMax must be of type int

@gioman
Copy link
Contributor Author

gioman commented Jun 1, 2023

More:

activating cache on a layer/datasource (gpkg) called "zona_contigua_24NM" causes the wmts:capabilities script to return an error:

For "zona_contigua_24NM" and "EPSG:4326" from TileMatrix 2 to 8
PHP Fatal error:  Uncaught ValueError: min(): Argument #1 ($value) must contain at least one element in /var/www/html/mapas/lizmap/modules/lizmap/lib/CliHelpers/WMTSCache.php:106
Stack trace:
#0 /var/www/html/mapas/lizmap/modules/lizmap/lib/CliHelpers/WMTSCache.php(106): min()
#1 /var/www/html/mapas/lizmap/modules/lizmap/lib/Commands/WMTSCapabilities.php(40): Lizmap\CliHelpers\WMTSCache->capabilities()
#2 /var/www/html/mapas/lizmap/vendor/symfony/console/Command/Command.php(298): Lizmap\Commands\WMTSCapabilities->execute()
#3 /var/www/html/mapas/lizmap/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#4 /var/www/html/mapas/lizmap/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#5 /var/www/html/mapas/lizmap/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#6 /var/www/html/mapas/lizmap/vendor/jelix/jelix/lib/jelix/Scripts/ModulesCommands.php(48): Symfony\Component\Console\Application->run()
#7 /var/www/html/mapas/lizmap/console.php(2): Jelix\Scripts\ModulesCommands::run()
#8 {main}
  thrown in /var/www/html/mapas/lizmap/modules/lizmap/lib/CliHelpers/WMTSCache.php on line 106

@nworr
Copy link
Contributor

nworr commented Jun 1, 2023

Does your layer zona_contigua_24NM have a scale constraint ?

@gioman
Copy link
Contributor Author

gioman commented Jun 1, 2023

Does your layer zona_contigua_24NM have a scale constraint ?

@nworr yes

@gioman
Copy link
Contributor Author

gioman commented Jun 1, 2023

@nworr yes

@nworr if that is the cause of the error maybe is worth considering catch the error and return a meaning message to the user.

@nworr
Copy link
Contributor

nworr commented Jun 1, 2023

Yes the PHP Fatal error: Uncaught ValueError: min() is related to a bug with scale, thank you for detailing this case.

it looks like none of the tile levels are within the min-max scale interval, must investigate.

if ($tileMatrix->scaleDenominator <= $maxScale && $tileMatrix->scaleDenominator >= $minScale) {

@gioman gioman changed the title [Bug]: Seeding not working if layer/datasource names hava spaces in it [Bug]: Seeding not working if layer/datasource names hava spaces in it. Not working for XYZ layers. Jun 1, 2023
@gioman
Copy link
Contributor Author

gioman commented Jun 1, 2023

Possibly found another corner case;

I have a layer called "grid" in a geopackage with the same name. No way that this layer shows in wmts:capabilities, but at the same time LMWC correctly creates the cache while navigating the map.

Maybe "grid" is some sort of reserved word?

@gioman
Copy link
Contributor Author

gioman commented Jun 2, 2023

I have a layer called "grid" in a geopackage with the same name. No way that this layer shows in wmts:capabilities, but at the same time LMWC correctly creates the cache while navigating the map.

and overnight... it magically decided to show in the capabilities...

@gioman
Copy link
Contributor Author

gioman commented Jun 2, 2023

@Gustry @nworr I'll continue to add questions/potential issues about caching/seeding here, let me know if/where you want me to split this into separate tickets.

I have a project that returns the following capabilities

For "sat" and "EPSG:4326" from TileMatrix 0 to 15
For "sat" and "EPSG:5016" from TileMatrix 0 to 10
For "sat" and "EPSG:3857" from TileMatrix 0 to 16

and for the layer

For "sat" and "EPSG:5016" the TileMatrix 0 has 1 tiles
For "sat" and "EPSG:5016" the TileMatrix 1 has 1 tiles
For "sat" and "EPSG:5016" the TileMatrix 2 has 4 tiles
For "sat" and "EPSG:5016" the TileMatrix 3 has 4 tiles
For "sat" and "EPSG:5016" the TileMatrix 4 has 4 tiles
For "sat" and "EPSG:5016" the TileMatrix 5 has 8 tiles
For "sat" and "EPSG:5016" the TileMatrix 6 has 24 tiles
For "sat" and "EPSG:5016" the TileMatrix 7 has 112 tiles
For "sat" and "EPSG:5016" the TileMatrix 8 has 416 tiles
For "sat" and "EPSG:5016" the TileMatrix 9 has 1664 tiles
For "sat" and "EPSG:5016" the TileMatrix 10 has 10240 tiles

When I seed with the script, what do mean that first two lines that end with "!"?
It is something that can be ignored?

php lizmap/console.php wmts:cache:seed -v -f reponame projectname sat EPSG:5016 1 10
The TileMatrixSet 'EPSG:4326'!
The TileMatrixSet 'EPSG:5016'!
1 tiles to generate for "sat" "EPSG:5016" "1"
4 tiles to generate for "sat" "EPSG:5016" "2"
4 tiles to generate for "sat" "EPSG:5016" "3"
4 tiles to generate for "sat" "EPSG:5016" "4"
8 tiles to generate for "sat" "EPSG:5016" "5"
24 tiles to generate for "sat" "EPSG:5016" "6"
112 tiles to generate for "sat" "EPSG:5016" "7"
416 tiles to generate for "sat" "EPSG:5016" "8"
1664 tiles to generate for "sat" "EPSG:5016" "9"
10240 tiles to generate for "sat" "EPSG:5016" "10"
12477 tiles to generate for "sat" "EPSG:5016" between "1" and "10"
Start generation
================

@gioman
Copy link
Contributor Author

gioman commented Jun 2, 2023

Does

lizmap/install/set_rights.sh

really set the rights correct for tiles when the cache dir has been set to something custom?

image

Looking at the script it does not look like to me that is doing that, confirmed also by checking permissions after having run the seeding command.

I guess that then the script should be changed, or docs changed in order to show to run the command as

sudo -u www-data php lizmap/console.php wmts:cache:seed -v -f montpellier montpellier bus EPSG:3857 12 14

@gioman
Copy link
Contributor Author

gioman commented Jun 2, 2023

Another thing that maybe has to be corrected in docs (https://docs.lizmap.com/current/en/admin/cache.html) is the following:

"In this example, you see that the bus layer has 3 different TileMatrixSet, corresponding to the 3 different spatial coordinate systems available for this project in Lizmap (configured in the Project properties ‣ QGIS Server)."

But it seems not 100% correct: my project properties has 3 CRSs listed, 3 from the CRSs represented by layers in the project and 1 added manually

image

but in wmts:capabilities only the first 3 show:

For "sat" and "EPSG:4326" from TileMatrix 0 to 15
For "sat" and "EPSG:5016" from TileMatrix 0 to 10
For "sat" and "EPSG:3857" from TileMatrix 0 to 16

@gioman
Copy link
Contributor Author

gioman commented Jun 2, 2023

One more thing for docs (I can do the PR if you ok this and the above observation):

I feel that it should be clarified that the tiles to be generated for a layer are the ones with the CRS of the project, not the ones with the CRS of the layer. And that new tiles for a different CRS must be eventually generated if the project CRS changes.

Maybe it would be also worth to change the seeding script to generate by default the tiles in the project CRS without having to specify it on the command line (unless it works already like this).

@gioman
Copy link
Contributor Author

gioman commented Jun 19, 2023

Any feedback?

@gioman
Copy link
Contributor Author

gioman commented Aug 16, 2023

Bumping my tickets before they go "quite",

@gioman
Copy link
Contributor Author

gioman commented Apr 9, 2024

@Gustry I would really appreciate any feedback on this matter. A few months have passed and the questions have not been answered and the situation has not improved. I'm on LM 3.6.11

To try start fresh:

  1. by activating

image

in LM plugin, then the folder(s) structure for the cache of the layer is created where configured here

image

but no files are written. Permissions are ok, otherwise the folder would not be created. Both the buttons to erase the cache for the whole repo, or a single layer do work, meaning that the proper folders are delete from the file system.

  1. pre-seeding:

despite diligently following https://docs.lizmap.com/current/en/admin/cache.html#configuring-the-caching-system pre-seeding seems also broken. Example:

sudo -u www-data php lizmap/console.php wmts:capabilities qgisserverdemos recart_exemplo_dgt
For "Edificio__Poligono" and "EPSG:3857" from TileMatrix 0 to 22
For "Edificio__Poligono" and "EPSG:3763" from TileMatrix 0 to 10
For "Area_agricola__florestal_ou_mato" and "EPSG:3857" from TileMatrix 0 to 22
For "Area_agricola__florestal_ou_mato" and "EPSG:3763" from TileMatrix 0 to 10
For "Bing_Satellite" and "EPSG:3857" from TileMatrix 0 to 22
For "Bing_Satellite" and "EPSG:3763" from TileMatrix 0 to 10
php lizmap/console.php wmts:capabilities -v qgisserverdemos recart_exemplo_dgt Bing_Satellite EPSG:3763
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 0 has 1 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 1 has 4 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 2 has 9 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 3 has 24 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 4 has 60 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 5 has 308 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 6 has 1176 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 7 has 4536 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 8 has 27720 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 9 has 110040 tiles
For "Bing_Satellite" and "EPSG:3763" the TileMatrix 10 has 437436 tiles
sudo -u www-data php lizmap/console.php wmts:cache:seed -v -f qgisserverdemos recart_exemplo_dgt Bing_Satellite EPSG:3763 1 2
The TileMatrixSet 'EPSG:3857'!
The TileMatrixSet 'EPSG:3763'!
4 tiles to generate for "Bing_Satellite" "EPSG:3763" "1"
9 tiles to generate for "Bing_Satellite" "EPSG:3763" "2"
13 tiles to generate for "Bing_Satellite" "EPSG:3763" between "1" and "2"
Start generation
================
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 0 / 0
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 0 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 1 / 0
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 1 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 1 / 1
Progression: 38%, 5 tiles generated on 13 tiles
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 1 / 2
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 1 / 3
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 2 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 2 / 2
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 2 / 3
Progression: 76%, 10 tiles generated on 13 tiles
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 3 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 3 / 2
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 3 / 3
================
End generation

and no tiles are generated.

With your "montpellier" demo project is even worst: after enabling the server cache for some layer, and after generating the capabilities for the service and the layer, the seeding command says there are no layers with cache enabled:

sudo -u www-data php lizmap/console.php wmts:capabilities qgisserverdemos montpellier
For "tramstop" and "EPSG:4326" from TileMatrix 0 to 19
For "tramstop" and "EPSG:3857" from TileMatrix 0 to 20
For "tramway" and "EPSG:4326" from TileMatrix 0 to 19
For "tramway" and "EPSG:3857" from TileMatrix 0 to 20
For "SousQuartiers" and "EPSG:4326" from TileMatrix 0 to 19
For "SousQuartiers" and "EPSG:3857" from TileMatrix 0 to 20
For "Quartiers" and "EPSG:4326" from TileMatrix 0 to 19
For "Quartiers" and "EPSG:3857" from TileMatrix 0 to 20
For "VilleMTP_MTP_Quartiers_2011_4326" and "EPSG:4326" from TileMatrix 2 to 19
For "VilleMTP_MTP_Quartiers_2011_4326" and "EPSG:3857" from TileMatrix 3 to 20
sudo -u www-data php lizmap/console.php wmts:capabilities -v qgisserverdemos montpellier "SousQuartiers" EPSG:3857
For "SousQuartiers" and "EPSG:3857" the TileMatrix 0 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 1 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 2 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 3 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 4 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 5 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 6 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 7 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 8 has 1 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 9 has 2 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 10 has 4 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 11 has 4 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 12 has 6 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 13 has 16 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 14 has 42 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 15 has 156 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 16 has 598 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 17 has 2295 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 18 has 8900 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 19 has 35223 tiles
For "SousQuartiers" and "EPSG:3857" the TileMatrix 20 has 140538 tiles
sudo -u www-data php lizmap/console.php wmts:cache:seed -v -f qgisserverdemos montpellier "SousQuartiers" EPSG:3857 1 9
No layers configured with cache!

Anything that would help understand if the issue is on my side or not would be appreciated.

Bonus question:

Imagining that caching is working (which is not for me on any setup I tried), what has the priority about expiration time, this in LMWC backend

image

or this in LM plugin

image

?

@gioman gioman changed the title [Bug]: Seeding not working if layer/datasource names hava spaces in it. Not working for XYZ layers. [Bug]: Cache and Seeding not working Apr 9, 2024
@gioman
Copy link
Contributor Author

gioman commented Apr 9, 2024

I changed the title because now cache and seeding are not working regardless of the source/type of layer.

@arno974
Copy link

arno974 commented Apr 12, 2024

Same for me, Lizmap can't cache tiles. The directory cache structure is created but no tiles are cached (manually or using seeding).

php lizmap/console.php wmts:capabilities mon_projet monprojet
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" from TileMatrix 0 to 21
php lizmap/console.php wmts:capabilities -v mon_projet monprojet "orthophotos-974-2022_cog_tif" "EPSG:2975"
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 0 has 16 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 1 has 25 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 2 has 120 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 3 has 440 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 4 has 1680 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 5 has 10192 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 6 has 40572 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 7 has 162288 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 8 has 1013320 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 9 has 1583925 tiles
For "orthophotos-974-2022_cog_tif" and "EPSG:2975" the TileMatrix 10 has 4049253 tiles
php lizmap/console.php wmts:cache:seed -v -f mon_projet monprojet "orthophotos-974-2022_cog_tif" "EPSG:2975" 1 1
The TileMatrixSet 'EPSG:3857'!
The TileMatrixSet 'EPSG:2975'!
25 tiles to generate for "orthophotos-974-2022_cog_tif" "EPSG:2975" "1"
25 tiles to generate for "orthophotos-974-2022_cog_tif" "EPSG:2975" between "1" and "1"
Start generation
================
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 0 / 0
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 0 / 1
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 0 / 2
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 0 / 3
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 0 / 4
Progression: 20%, 5 tiles generated on 25 tiles
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 1 / 0
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 1 / 1
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 1 / 2
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 1 / 3
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 1 / 4
Progression: 40%, 10 tiles generated on 25 tiles
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 2 / 0
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 2 / 1
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 2 / 2
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 2 / 3
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 2 / 4
Progression: 60%, 15 tiles generated on 25 tiles
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 3 / 0
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 3 / 1
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 3 / 2
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 3 / 3
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 3 / 4
Progression: 80%, 20 tiles generated on 25 tiles
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 4 / 0
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 4 / 1
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 4 / 2
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 4 / 3
Error, tile not cached: orthophotos-974-2022_cog_tif / EPSG:2975 / 1 / 4 / 4
Progression: 100%, 25 tiles generated on 25 tiles
================
End generation

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

but no tiles are cached (manually or using seeding).

thanks for confirming.

@Gustry
Copy link
Member

Gustry commented Apr 12, 2024

Thanks for trying.
There is some unit tests about this CLI tool done automatically :

https://github.com/3liz/lizmap-web-client/blob/master/tests/end2end/cypress/integration/cmdline-wmts-ghaction.js

The storage backend is Redis, not file based. It's checking exit code and STD out.

No redis user ?

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

No redis user ?

@Gustry thanks for the reply. For many simple use cases Redis seems an overkill to me, but if it works... should we assume that at this moment file based caching is broken?

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

Morever, does not Redis now pose a problem from a licensing point of view, at least for some potential LMWC user?

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

@Gustry no changes after configuring LMWC to use Redis

sudo -u www-data php lizmap/console.php wmts:cache:seed -v -f qgisserverdemos recart_exemplo_dgt Bing_Satellite EPSG:3763 1 2
The TileMatrixSet 'EPSG:3857'!
The TileMatrixSet 'EPSG:3763'!
4 tiles to generate for "Bing_Satellite" "EPSG:3763" "1"
9 tiles to generate for "Bing_Satellite" "EPSG:3763" "2"
13 tiles to generate for "Bing_Satellite" "EPSG:3763" between "1" and "2"
Start generation
================
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 0 / 0
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 0 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 1 / 0
Error, tile not cached: Bing_Satellite / EPSG:3763 / 1 / 1 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 1 / 1
Progression: 38%, 5 tiles generated on 13 tiles
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 1 / 2
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 1 / 3
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 2 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 2 / 2
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 2 / 3
Progression: 76%, 10 tiles generated on 13 tiles
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 3 / 1
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 3 / 2
Error, tile not cached: Bing_Satellite / EPSG:3763 / 2 / 3 / 3
================
End generation

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

And same thing with SQLITE.

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

@Gustry no changes after configuring LMWC to use Redis

127.0.0.1:6379> KEYS *
(empty array)
127.0.0.1:6379> MONITOR
OK

Nothing moves into Redis when navigating a project that has a few layers set with server cache.

@nworr
Copy link
Contributor

nworr commented Apr 12, 2024

I tested the developpement stack , the /tmp/ cache folder is filled when using console or manually browsing the map, so i think it's not a cache provider problem (file/redis).

@gioman , with a file cache, does browsing the map create file in cached foler ?
I assume there's more a project or layer related issue

looking at the code there's this line that disable cache when requested content don't have image/ mime type

Can you check the mime type returned for your layer ?

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

@gioman , with a file cache, does browsing the map create file in cached foler ?

@nworr it creates JUST the folder structure, but no cache/tile files.

I assume there's more a project or layer related issue

If so I would find this very puzzling. Can you name a project/lizmap plugin I could possibly be missing in order to not have the cache be generated?

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

Can you check the mime type returned for your layer ?

@nworr returned by what? The underlying WMS service?

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

looking at the code there's this line that disable cache when requested content don't have image/ mime type

@nworr I commented those lines, re-run the LMWC installer: no change.

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

ok, it works (tested files for now) on a completely separated server (both Ubuntu Server 22.04) with the only difference between the two that the first is a cloud one that comes with only root, while the other was installed in a more conventional way and had a user with sudo permission that is used instead of root. Anyway this does not explain well why on the first one also Redis cache does not work.

Any hint is appreciated.

@gioman
Copy link
Contributor Author

gioman commented Apr 12, 2024

Regardless, is still not possible to generate tiles for level 0

For "Ortos2018" and "EPSG:3763" the TileMatrix 0 has 6 tiles

sudo -u www-data php lizmap/console.php wmts:cache:seed -v -f testes teste1 Ortos2018 EPSG:3763 0 1
TileMatrixMin and TileMatrixMax must be of type int

@gioman
Copy link
Contributor Author

gioman commented Apr 13, 2024

The error "Error, tile not cached" comes from here

$outputCallback('Error, tile not cached: '.$layer->name.' / '.$tileMatrixSetId.' / '.$tileMatrixLimit->id.' / '.$row.' / '.$col.'');

any idea of what triggers that case?

@gioman
Copy link
Contributor Author

gioman commented Apr 13, 2024

@Gustry it is a regression somewhere in between LMWC 3.6.4 (still working) and 3.6.10 (not working). I tested a 3.6.4 and 3.6,10 installation on the same machine were I was testing 3.6.11 and on .4 caching still works as expected (used the same project ans settings on all tests).

@gioman gioman changed the title [Bug]: Cache and Seeding not working [Bug]: Cache and Seeding not working anymore on LMWC 3.6.10/11 Apr 13, 2024
@gioman
Copy link
Contributor Author

gioman commented Apr 15, 2024

@Gustry it is a regression somewhere in between LMWC 3.6.4 (still working) and 3.6.10 (not working). I tested a 3.6.4 and 3.6,10 installation on the same machine were I was testing 3.6.11 and on .4 caching still works as expected (used the same project ans settings on all tests).

This also probably is not true: as I commented before I tested successfully caching with LMWC 3.6.11 on a different machine.

So this is the state of my observations:

*) I have a machine with Ubuntu server 22.04/apache where caching works for a LMWC 3.6.4, but not for 3.6.11 (on both a clean install of 3.6.11 and as well an installation that has been upgraded along time). Tests have been made with the very sames projects.

*) Even on LMWC installations where caching works for some projects/layers is pretty easy to replicate cases where there is no way to make it acknowledge that there are layers with caching active

*) caching does not work for XYZ layers, as the ones added with the QMS plugin. I have vague remembering that this worked in the past, if not or if support for this layers has been removed (from caching capabilities) then should be documented

*) the pre-seeding script generates an error if seeding level 0, which is shown as part of the WMTS capabilities.

@gioman gioman changed the title [Bug]: Cache and Seeding not working anymore on LMWC 3.6.10/11 [Bug]: Caching/Seeding not working Apr 15, 2024
@gioman
Copy link
Contributor Author

gioman commented Apr 18, 2024

the pre-seeding script generates an error if seeding level 0, which is shown as part of the WMTS capabilities.

The above it seems to have been addressed by a patch thanks @nworr ! I'm wondering if there is any chance to get any feedback about the remaining issues. I understand that the first one may be a local issue (maybe), but the second and there are probably not (the third one is not). Thanks in advance.

@ppetru
Copy link
Contributor

ppetru commented Sep 7, 2024

Regarding the layer names, #4737 was what (finally) made caching work for me.

@gioman
Copy link
Contributor Author

gioman commented Sep 9, 2024

Regarding the layer names, #4737 was what (finally) made caching work for me.

@ppetru thanks for confirming and fixing this part of the issue.

@Gustry
Copy link
Member

Gustry commented Sep 16, 2024

Thanks @ppetru for fix. We will make releases soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants