Skip to content

Commit 445c70f

Browse files
committed
When spawning an app process, warn instead of crash when error occurs during checking whether app process socket is connectable
1 parent 96425a0 commit 445c70f

File tree

1 file changed

+12
-2
lines changed
  • src/agent/Core/SpawningKit/Handshake

1 file changed

+12
-2
lines changed

src/agent/Core/SpawningKit/Handshake/Perform.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <oxt/backtrace.hpp>
3535
#include <string>
3636
#include <vector>
37-
#include <stdexcept>
37+
#include <exception>
3838
#include <cstddef>
3939
#include <cstdlib>
4040
#include <cerrno>
@@ -196,8 +196,18 @@ class HandshakePerform {
196196

197197
while (true) {
198198
unsigned long long timeout = 100000;
199+
bool pingable;
199200

200-
if (pingTcpServer("127.0.0.1", session.expectedStartPort, &timeout)) {
201+
try {
202+
pingable = pingTcpServer("127.0.0.1", session.expectedStartPort, &timeout);
203+
} catch (const std::exception &e) {
204+
P_WARN("Error checking whether 127.0.0.1:" << session.expectedStartPort
205+
<< " is connectable: " << e.what());
206+
syscalls::usleep(50000);
207+
continue;
208+
}
209+
210+
if (pingable) {
201211
boost::lock_guard<boost::mutex> l(syncher);
202212
socketIsNowPingable = true;
203213
finishState = FINISH_SUCCESS;

0 commit comments

Comments
 (0)