In case of invalid connectivity settings, EPC transport's listenLoop() thread may tear down the server. In this case, the main thread won't reach the waitForDisconnect() in the main function and instead exit via ExitOnErr before. The server's ShutdownErr member will still hold an unchecked error, which causes an abnormal shutdown:
SimpleRemoteEPCServer::sendMessage: opc = Setup, seqno = 0, tag-addr = 0x0, arg-buffer = 0x48c bytes \--> SimpleRemoteEPC::sendMessage failed Program aborted due to an unhandled Error: Bad file descriptor
Call-stack of the main thread:
abort() llvm::Error::fatalUncheckedError() const llvm::Error::assertIsChecked() llvm::Error::~Error() llvm::orc::SimpleRemoteEPCServer::~SimpleRemoteEPCServer() ... llvm::Expected<...> llvm::orc::SimpleRemoteEPCServer::Create<...>(...) main
With this patch applied, the server will shutdown gracefully:
SimpleRemoteEPCServer::sendMessage: opc = Setup, seqno = 0, tag-addr = 0x0, arg-buffer = 0x48c bytes \--> SimpleRemoteEPC::sendMessage failed SimpleRemoteEPCServer: Bad file descriptor llvm-jitlink-executor: Bad file descriptor
The duplicate error message appears to be originating from the two threads involved.