server.Reset invokes ServiceRegistry.Reset which acquires a RW-lock on the mutex. However, before the lock is released (by the defer), it invokes AddServiceFromGlobal which (when adding the WKTs) invokes registry.AddFile which attempts to acquire a R-lock on the mutex (and can't).
Thanks for reporting this! I've pushed a fix up for this. Can you please see if this works better for you now? Feel free to re-open if it's still an issue
https://github.com/sudorandom/fauxrpc/blob/b4e3ecc67000ff6ee0b99acb306f264f097fa441/private/registry/registry.go#L42
Calls to
RegistryService.Reset
block indefinitely:server.Reset
invokesServiceRegistry.Reset
which acquires a RW-lock on the mutex. However, before the lock is released (by thedefer
), it invokesAddServiceFromGlobal
which (when adding the WKTs) invokesregistry.AddFile
which attempts to acquire a R-lock on the mutex (and can't).I debugged by adding lambda around the locks:
server.go
:registry.go
:And used the above
gRPCurl
, the output is: