asyncio on GKE

I have a script that uses the GeoTiler library. On my Mac, I can launch several concurrent instances of the script with no issue. When I upload the script to GKE, the following lines of code:

```
    task = render_map_async(map, downloader=downloader, **kw)
    loop = asyncio.get_event_loop()
    return loop.run_until_complete(task)
```

ALWAYS raises the error:

RuntimeError: There is no current event loop in thread 'ThreadPoolExecutor- """ThreadScheduler_1'."""

Following suggestions I found on line, I have tried to replace the above code with the following modification:

task = render_map_async(map, downloader=downloader, **kw)
    try:
        loop  = asyncio.get_event_loop()
    except RuntimeError as ex:
        if "There is no current event loop in thread" in str(ex):
            loop = asyncio.new_event_loop()
            asyncio.set_event_loop(loop)
        return loop.run_until_complete(task)

With this modification, the script works IF AND ONLY IF there is only 1 instance of the script working in a pod. This is an improvement but still not enough: as soon as a second instance is launched on the same pod, the script starts working but eventually it throws the error:

File "/overlay/venv/lib/python3.10/site-packages/gopro_overlay/layout.py", line 106, in draw
    return self.scene.draw()
  File "/overlay/venv/lib/python3.10/site-packages/gopro_overlay/widgets/widgets.py", line 236, in draw
    w.draw(image, draw)
  File "/overlay/venv/lib/python3.10/site-packages/gopro_overlay/widgets/widgets.py", line 32, in draw
    w.draw(image, draw)
  File "/overlay/venv/lib/python3.10/site-packages/gopro_overlay/widgets/map.py", line 189, in draw
    self.cached = self._redraw(map)
  File "/overlay/venv/lib/python3.10/site-packages/gopro_overlay/widgets/map.py", line 167, in _redraw
    image = self.renderer(map)
  File "/overlay/venv/lib/python3.10/site-packages/gopro_overlay/geo.py", line 109, in render
    return geotiler.render_map(map, tiles, downloader=dbm_downloader(dbm_file), **kwargs)
  File "/overlay/venv/lib/python3.10/site-packages/geotiler/map.py", line 377, in render_map
    return loop.run_until_complete(task)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/overlay/venv/lib/python3.10/site-packages/geotiler/map.py", line 400, in render_map_async
    return await render_image(map, tiles)
  File "/overlay/venv/lib/python3.10/site-packages/geotiler/tile/img.py", line 68, in render_image
    img = _tile_image(tile.img) if tile.img else error
  File "/overlay/venv/lib/python3.10/site-packages/geotiler/tile/img.py", line 99, in _tile_image
    return PIL.Image.open(f).convert('RGBA')
  File "/overlay/venv/lib/python3.10/site-packages/PIL/Image.py", line 937, in convert
    self.load()
  File "/overlay/venv/lib/python3.10/site-packages/PIL/ImageFile.py", line 288, in load
    raise_oserror(err_code)
  File "/overlay/venv/lib/python3.10/site-packages/PIL/ImageFile.py", line 72, in raise_oserror
    raise OSError(msg)
OSError: unrecognized data stream contents when reading image file

How can I solve this problem?