kubernetes-sigs/gcp-compute-persistent-disk-csi-driver

ListVolumes and ListSnapshots are not client concurrency safe

pwschuurman opened this issue · 4 comments

The ListVolumes and ListSnapshots API calls support pagination. This allows the driver to call the GCE API and paginate the response back to the client that is calling into the CSI driver controller server via gRPC. The results are stored in the CSI driver controller's memory and read back in subsequent calls.

If there are distinct clients calling either of these APIs, and call sequences overlap, this can lead to a race condition and unsafe memory access by different response handler threads in the CSI driver controller server. The shared memory (disks/snapshots/tokens/snapshotTokens) should have an associated mutex to ensure that reads/writes are only performed by a single thread in the controller server at one time.