consulate icon indicating copy to clipboard operation
consulate copied to clipboard

Consul kv race condition 'Error setting "$key" (200)'

Open ThisWillGoWell opened this issue 6 years ago • 0 comments

There appears to be some sort of race condition when setting/deleting a key from two different threads/processes. For example:

import consulate
import threading

def update():
    try:
        session.kv['test'] = 'true'
        del session.kv['test']
    except Exception as e:
        print(e)

session = consulate.Session()
threading.Thread(target=update).start()
threading.Thread(target=update).start()

will produce:

'Error setting "test" (200)'

Consul is running in a local docker container. Is the the expected behavior/why does consul return a 200 with empty body?

ThisWillGoWell avatar May 03 '18 20:05 ThisWillGoWell