Backport PR14993
6c10037f72073eecc674c313580ef50a4f1e1e44 rpc: Fix data race (UB) in InterruptRPC() (practicalswift)
Pull request description:
Fix data race (UB) in `InterruptRPC()`.
Before:
```
$ ./configure --with-sanitizers=thread
$ make
$ test/functional/test_runner.py feature_shutdown.py
…
SUMMARY: ThreadSanitizer: data race rpc/server.cpp:314 in InterruptRPC()
…
ALL | ✖ Failed | 2 s (accumulated)
```
After:
```
$ ./configure --with-sanitizers=thread
$ make
$ test/functional/test_runner.py feature_shutdown.py
…
ALL | ✓ Passed | 3 s (accumulated)
```