Skip to content

Crash on OS X when accessing keyring from multiple processes #281

@renatahodovan

Description

@renatahodovan

OS: Mac OS Sierra, 10.12.5
Version: 10.3

Description: Crash happens (with -11 exit code) when trying to ask for a password both from the main process and from a subprocess. See the repro case below.

After some digging, it seems that the issue happens in the SecKeychainFindGenericPassword() call of backends/_OS_X_API.py: find_generic_password().

import keyring

from multiprocessing import Process

from_address = '[email protected]'

def my_subprocess():
    keyring.get_password('myapp', from_address)
    print('ok')

# comment out the line below to get things work(around)
keyring.get_password('myapp', from_address)

proc1 = Process(target=my_subprocess)
proc1.start()
proc1.join()
print(proc1.exitcode)

proc2 = Process(target=my_subprocess)
proc2.start()
proc2.join()
print(proc2.exitcode)

# expected output:
# ok
# 0
# ok
# 0
#
# current output:
# -11
# -11

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions