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

ERROR 1: PROJ: Cannot take exclusive lock on .local/share/proj/cache.db #3959

Open
MarcYin opened this issue Nov 21, 2023 · 4 comments
Open
Labels

Comments

@MarcYin
Copy link

MarcYin commented Nov 21, 2023

When import gdal, the PROJ library throws error:

ERROR 1: PROJ: Cannot take exclusive lock on .local/share/proj/cache.db

This only happens when I have multiple computing nodes using the same conda environment

from osgeo import gdal

Problem description

Expected Output

Environment Information

  • PROJ version (proj 9.1.1)
  • Linux version 3.10.0-1160.92.1.el7.x86_64

Installation method

  • mamba
@MarcYin MarcYin added the bug label Nov 21, 2023
@rouault
Copy link
Member

rouault commented Nov 21, 2023

@MarcYin It would be useful if you could provide a minimum Python reproducer with either gdal or pyproj4

You can also try setting the PROJ_LOCK_MAX_ITERS environment variable to a value greater than 30. 30 corresponds to ~ 1 second of retry attempts to get the exclusive lock

@MarcYin
Copy link
Author

MarcYin commented Nov 22, 2023

Hi,

It is a bit python code involves creating VRT from list of tif file to resample them to 10 meters and read:

from osgeo import gdal

url_header = '/vsicurl/https://gws-access.jasmin.ac.uk/public/nceo_isp/S2/30/U/VB/S2A_MSIL1C_20211028T111201_N0301_R137_T30UVB_20211028T131717.SAFE/GRANULE/L1C_T30UVB_A033167_20211028T111452/IMG_DATA/T30UVB_20211028T111201_'
sur_refs = [f'{url_header}{band}_sur.tif' for band in ['B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B8A', 'B11', 'B12']]

# Reflectance
g = gdal.BuildVRT('', sur_refs, separate=True, xRes=10, yRes=10, resampleAlg=gdal.GRIORA_NearestNeighbour)
data = g.ReadAsArray()
print(data.shape)

@rouault
Copy link
Member

rouault commented Nov 22, 2023

It is a bit python code involves creating VRT from list of tif file to resample them to 10 meters and read:

that doesn't hit the bug. I guess you need to add some multiprocessing/multithreading on top of that to build a full reproducer

@MarcYin
Copy link
Author

MarcYin commented Nov 22, 2023

Hi,

I was trying to do that but it seems not tigger the error. But I hope a bit more context on this will help to identify the potential issue. The processing involves:

  1. reading the Sentinel-2 data using the code I posted above (potential issue here for crossing meridian line?)
  2. reading a land cover map in British National Grid projection covering the Sentinel-2 tile with gdalwarp (potential issue here for projecting the British National Grid to the different MGRS tile projection?)

The Sentinel-2 data covers the entire UK, and the reading of data is submitted to different computing nodes sharing the same conda environment.

The error I mentioned above did not trigger all the time, but only occasionally.

Thanks.

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

2 participants