From: mquinson Date: Fri, 26 Nov 2010 09:37:19 +0000 (+0000) Subject: some more paranoia to track that damn bug X-Git-Tag: v3_5~166 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b28635d8ae9d5ce25acb5d2a27268a1ab94f9560 some more paranoia to track that damn bug git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8664 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/gras/Transport/transport_plugin_sg.c b/src/gras/Transport/transport_plugin_sg.c index f83b704373..6cd4c728ab 100644 --- a/src/gras/Transport/transport_plugin_sg.c +++ b/src/gras/Transport/transport_plugin_sg.c @@ -91,8 +91,20 @@ static const char* gras_trp_sg_peer_name(gras_socket_t s) { gras_trp_sg_sock_data_t sockdata = s->data; if (sockdata->server == SIMIX_process_self()) return SIMIX_host_get_name(SIMIX_process_get_host(sockdata->client)); - else + else { + if (sockdata->client!=SIMIX_process_self()) { + /* THAT'S BAD! I should be either client or server of the sockets I get messages on!! */ + /* This is where the bug is visible. Try to die as loudly as possible */ + xbt_backtrace_display_current(); + ((char*)s)[sizeof(*s)+1] = '0'; /* Try to make valgrind angry to see where that damn socket comes from */ + xbt_die(bprintf("I'm not the client in socket %p (comm:%p, rdvser=%p, rdvcli=%p) to %s, that's %s", + socket,sockdata->comm_recv,sockdata->rdv_server,sockdata->rdv_client, + SIMIX_host_get_name(SIMIX_process_get_host(sockdata->server)), + SIMIX_host_get_name(SIMIX_process_get_host(sockdata->client)))); + } + xbt_assert(sockdata->client_port==gras_os_myport()); return SIMIX_host_get_name(SIMIX_process_get_host(sockdata->server)); + } } static const char* gras_trp_sg_peer_proc(gras_socket_t s) { THROW_UNIMPLEMENTED; @@ -169,7 +181,7 @@ void gras_trp_sg_socket_client(gras_trp_plugin_t self, } /* create simulation data of the socket */ - data = xbt_new(s_gras_trp_sg_sock_data_t, 1); + data = xbt_new0(s_gras_trp_sg_sock_data_t, 1); data->client = SIMIX_process_self(); data->server = pr->server; data->server_port = port; @@ -219,7 +231,7 @@ void gras_trp_sg_socket_server(gras_trp_plugin_t self, int port, gras_socket_t s xbt_dynar_push(hd->ports, &pr); /* Create the socket */ - data = xbt_new(s_gras_trp_sg_sock_data_t, 1); + data = xbt_new0(s_gras_trp_sg_sock_data_t, 1); data->server = SIMIX_process_self(); data->server_port = port; data->client = NULL;