In case scdaemon is killed or crashed, gpg-agent does not restart scdaemon but attempts to send commands and waits indefinitely for responses. That used to work. Reproducer is obvious. Not tested with 2.2.
That's my badness. In wait_child_thread, assuan_release may cause thread context switch to agent_reset_scd which accesses scd_local_list; This access should be serialized.
And... in start_scd, calling unlock_scd should be after unlocking start_scd_lock.