For multithreaded and low-level unsafe interfacing server code, the ability to use LLVM’s ThreadSanitizer and
AddressSanitizer can help troubleshoot invalid thread usage and invalid usage/access of memory.
There is a blog post outlining the usage of TSAN.
The short story is to use the swiftc command line options
-sanitize=thread to each respective tool.
Also for Swift Package Manager projects you can use
--sanitize at the command line, e.g.:
swift build --sanitize=address
swift build --sanitize=thread
and it can be used for the tests too:
swift test --sanitize=address
swift test --sanitize=thread