Skip to content

Commit 40afd52

Browse files
committed
btl/tcp: make error messages more specific
Convert some verbose messages to opal_show_help() messages. Signed-off-by: Jeff Squyres <[email protected]>
1 parent e0d86b1 commit 40afd52

File tree

2 files changed

+87
-50
lines changed

2 files changed

+87
-50
lines changed

opal/mca/btl/tcp/btl_tcp_component.c

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2007-2018 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
1515
* Copyright (c) 2009 Oak Ridge National Laboratory
1616
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
@@ -1363,7 +1363,6 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
13631363
mca_btl_tcp_endpoint_hs_msg_t hs_msg;
13641364
struct timeval save, tv;
13651365
socklen_t rcvtimeo_save_len = sizeof(save);
1366-
char str[128];
13671366

13681367
/* Note, Socket will be in blocking mode during intial handshake
13691368
* hence setting SO_RCVTIMEO to say 2 seconds here to avoid waiting
@@ -1376,20 +1375,22 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
13761375
if (ENOPROTOOPT == errno) {
13771376
sockopt = false;
13781377
} else {
1379-
opal_output_verbose(20, opal_btl_base_framework.framework_output,
1380-
"Cannot get current recv timeout value of the socket"
1381-
"Local_host:%s PID:%d",
1382-
opal_process_info.nodename, getpid());
1378+
opal_show_help("help-mpi-btl-tcp.txt", "socket flag fail",
1379+
true, opal_process_info.nodename,
1380+
getpid(),
1381+
"getsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, ...)",
1382+
strerror(opal_socket_errno), opal_socket_errno);
13831383
return;
13841384
}
13851385
} else {
13861386
tv.tv_sec = 2;
13871387
tv.tv_usec = 0;
13881388
if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv))) {
1389-
opal_output_verbose(20, opal_btl_base_framework.framework_output,
1390-
"Cannot set new recv timeout value of the socket"
1391-
"Local_host:%s PID:%d",
1392-
opal_process_info.nodename, getpid());
1389+
opal_show_help("help-mpi-btl-tcp.txt", "socket flag fail",
1390+
true, opal_process_info.nodename,
1391+
getpid(),
1392+
"setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, ...)",
1393+
strerror(opal_socket_errno), opal_socket_errno);
13931394
return;
13941395
}
13951396
}
@@ -1408,14 +1409,16 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
14081409
* This attempted connection will be ignored; your MPI job may or may not
14091410
* continue properly.
14101411
*/
1411-
if (sizeof(hs_msg) != retval) {
1412-
opal_output_verbose(20, opal_btl_base_framework.framework_output,
1413-
"process did not receive full connect ACK "
1414-
"Local_host:%s PID:%d String_received:%s Test_fail:%s",
1415-
opal_process_info.nodename,
1416-
getpid(),
1417-
(retval > 0) ? hs_msg.magic_id : "<nothing>",
1418-
"handshake message length");
1412+
if (sizeof(hs_msg) != retval) {
1413+
const char *peer = opal_fd_get_peer_name(sd);
1414+
opal_show_help("help-mpi-btl-tcp.txt",
1415+
"did not receive full magic id string",
1416+
true,
1417+
opal_process_info.nodename,
1418+
getpid(),
1419+
opal_version_string,
1420+
peer);
1421+
free((char*) peer);
14191422

14201423
/* The other side probably isn't OMPI, so just hang up */
14211424
CLOSE_THE_SOCKET(sd);
@@ -1424,12 +1427,18 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
14241427

14251428
guid = hs_msg.guid;
14261429
if (0 != strncmp(hs_msg.magic_id, mca_btl_tcp_magic_id_string, len)) {
1427-
opal_output_verbose(20, opal_btl_base_framework.framework_output,
1428-
"process did not receive right magic string. "
1429-
"Local_host:%s PID:%d String_received:%s Test_fail:%s",
1430-
opal_process_info.nodename,
1431-
getpid(), hs_msg.magic_id,
1432-
"string value");
1430+
const char *peer = opal_fd_get_peer_name(sd);
1431+
opal_show_help("help-mpi-btl-tcp.txt",
1432+
"received incorrect magic id string",
1433+
true,
1434+
opal_process_info.nodename,
1435+
getpid(),
1436+
opal_version_string,
1437+
peer,
1438+
hs_msg.magic_id,
1439+
mca_btl_tcp_magic_id_string);
1440+
free((char*) peer);
1441+
14331442
/* The other side probably isn't OMPI, so just hang up */
14341443
CLOSE_THE_SOCKET(sd);
14351444
return;
@@ -1438,10 +1447,11 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
14381447
if (sockopt) {
14391448
/* reset RECVTIMEO option to its original state */
14401449
if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &save, sizeof(save))) {
1441-
opal_output_verbose(20, opal_btl_base_framework.framework_output,
1442-
"Cannot reset recv timeout value"
1443-
"Local_host:%s PID:%d",
1444-
opal_process_info.nodename, getpid());
1450+
opal_show_help("help-mpi-btl-tcp.txt", "socket flag fail",
1451+
true, opal_process_info.nodename,
1452+
getpid(),
1453+
"setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, ...)",
1454+
strerror(opal_socket_errno), opal_socket_errno);
14451455
return;
14461456
}
14471457
}
@@ -1492,24 +1502,9 @@ static void mca_btl_tcp_component_recv_handler(int sd, short flags, void* user)
14921502
/* are there any existing peer instances willing to accept this connection */
14931503
(void)mca_btl_tcp_proc_accept(btl_proc, (struct sockaddr*)&addr, sd);
14941504

1495-
switch (addr.ss_family) {
1496-
case AF_INET:
1497-
inet_ntop(AF_INET, &(((struct sockaddr_in*) &addr)->sin_addr), str, sizeof(str));
1498-
break;
1499-
1500-
#if OPAL_ENABLE_IPV6
1501-
case AF_INET6:
1502-
inet_ntop(AF_INET6, &(((struct sockaddr_in6*) &addr)->sin6_addr), str, sizeof(str));
1503-
break;
1504-
#endif
1505-
1506-
default:
1507-
BTL_ERROR(("Got an accept() from an unknown address family -- this shouldn't happen"));
1508-
CLOSE_THE_SOCKET(sd);
1509-
return;
1510-
1511-
}
1505+
const char *str = opal_fd_get_peer_name(sd);
15121506
opal_output_verbose(10, opal_btl_base_framework.framework_output,
15131507
"btl:tcp: now connected to %s, process %s", str,
15141508
OPAL_NAME_PRINT(btl_proc->proc_opal->proc_name));
1509+
free((char*) str);
15151510
}

opal/mca/btl/tcp/help-mpi-btl-tcp.txt

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ values are in the range [1 .. 2^16-1]. This value will be ignored
3535
WARNING: Open MPI failed to TCP connect to a peer MPI process. This
3636
should not happen.
3737

38-
Your Open MPI job may now fail.
38+
Your Open MPI job may now hang or fail.
3939

4040
Local host: %s
4141
PID: %d
@@ -46,7 +46,7 @@ Your Open MPI job may now fail.
4646
WARNING: Open MPI failed to handshake with a connecting peer MPI
4747
process over TCP. This should not happen.
4848

49-
Your Open MPI job may now fail.
49+
Your Open MPI job may now hang or fail.
5050

5151
Local host: %s
5252
PID: %d
@@ -102,8 +102,11 @@ hopefully be able to continue).
102102
Known IPs of peer: %s
103103
#
104104
[socket flag fail]
105-
WARNING: Open MPI failed to set flags on a TCP socket. This should
106-
not happen. It is likely that your MPI job will now fail.
105+
WARNING: Open MPI failed to get or set flags on a TCP socket. This
106+
should not happen.
107+
108+
This may cause unpredictable behavior, and may end up hanging or
109+
aborting your job.
107110

108111
Local host: %s
109112
PID: %d
@@ -164,4 +167,43 @@ Your Open MPI job may now fail.
164167
PID: %d
165168
Message: %s
166169
Error: %s (%d)
167-
#
170+
#
171+
[did not receive full magic id string]
172+
The TCP BTL received an inbound socket connection from an unidentified
173+
peer. This typically means one of two things:
174+
175+
1. A non-Open MPI process tried to connect to this Open MPI process.
176+
2. An Open MPI process compiled against a different version of Open
177+
MPI tried to connect to this Open MPI process.
178+
179+
Open MPI only supports running exactly the same version between all
180+
processes in a single job.
181+
182+
This may cause unpredictable behavior, and may end up aborting your
183+
job.
184+
185+
Local host: %s
186+
Local PID: %d
187+
Local Open MPI version: %s
188+
Peer IP address: %s
189+
#
190+
[received incorrect magic id string]
191+
The TCP BTL received an inbound socket connection from a peer that did
192+
not identify itself correctly as an Open MPI process. This typically
193+
means one of two things:
194+
195+
1. A non-Open MPI process tried to connect to this Open MPI process.
196+
2. An Open MPI process compiled against a different version of Open
197+
MPI tried to connect to this Open MPI process.
198+
199+
Open MPI only supports running exactly the same version between all
200+
processes in a single job.
201+
202+
This may cause unpredictable behavior, and may end up hanging or
203+
aborting your job.
204+
205+
Local host: %s
206+
Local PID: %d
207+
Local Open MPI version: %s
208+
Peer IP address: %s
209+
Peer identifier: %s (expected %s)

0 commit comments

Comments
 (0)