apache/arrow-flight-sql-postgresql

read/write wait logic may be deadlock

Closed this issue · 0 comments

kou commented

If we can't read/write any data, the current logic waits until any readable data/write space is available. For example, here is the read wait workflow:

  1. read() -> 0 bytes read
  2. wait()
    1. Check the current readable size in a shared buffer
    2. Loop
      1. Check the current readable size in a shared buffer
      2. Compare 2.ii.a with 2.i

We don't acquire a lock between 1. and 2.i. If new data is arrived between 1. and 2.i, the new data isn't detected. It may cause a deadlock.