From: Aleš Křenek Date: Wed, 25 Jun 2008 10:09:20 +0000 (+0000) Subject: merge 313_5 X-Git-Tag: merge_313_5_after~10 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=c516d3c34873b2a5fd37e8065946694e512cec29;p=jra1mw.git merge 313_5 --- diff --git a/org.glite.lb.client/examples/job_log.c b/org.glite.lb.client/examples/job_log.c index ba571e1..26c9611 100644 --- a/org.glite.lb.client/examples/job_log.c +++ b/org.glite.lb.client/examples/job_log.c @@ -112,7 +112,6 @@ int main(int argc,char **argv) return 0; -err: #ifdef USE_CALLBACKS edg_wll_UnregisterTestQueryEvents(); #endif diff --git a/org.glite.lb.client/examples/multiple_user_jobs.c b/org.glite.lb.client/examples/multiple_user_jobs.c index b4efbb9..bb08981 100644 --- a/org.glite.lb.client/examples/multiple_user_jobs.c +++ b/org.glite.lb.client/examples/multiple_user_jobs.c @@ -31,10 +31,9 @@ int main(int argc,char **argv) { edg_wll_Context *p_ctx; char *errt,*errd; - edg_wlc_JobId **jobs = NULL; + glite_jobid_t **jobs = NULL; edg_wll_JobStat **states = NULL; int i,j,k; - int proxy_file_no = 0; int no_of_runs; if ((argc<2) || !strcmp(argv[1], "-h")) {usage(argv[0]); exit(0);} @@ -106,7 +105,7 @@ err: if (states) { for (k=0; k < no_of_runs; k++) { if (states[k]) - for (i=0; states[k][i].state; i++) edg_wll_FreeStatus(&states[i]); + for (i=0; states[k][i].state; i++) edg_wll_FreeStatus(states[i]); } free(states); } diff --git a/org.glite.lb.client/examples/user_jobs_threaded.c b/org.glite.lb.client/examples/user_jobs_threaded.c index ce01e0e..5283112 100644 --- a/org.glite.lb.client/examples/user_jobs_threaded.c +++ b/org.glite.lb.client/examples/user_jobs_threaded.c @@ -72,7 +72,7 @@ void *thread_code(thread_code_args *arguments) { sl = (unsigned long) ((double) random()/ RAND_MAX * arguments->rand_start * 1000000); - printf("Thread [%d] - sleeping for %ld us\n",pthread_self(),sl); + printf("Thread [%lu] - sleeping for %ld us\n",(unsigned long)pthread_self(),sl); usleep( sl ); user_jobs = edg_wll_UserJobs; @@ -215,5 +215,6 @@ int main(int argc,char **argv) // exit(0); // pthread_exit(NULL); + return 0; } diff --git a/org.glite.lb.client/project/ChangeLog b/org.glite.lb.client/project/ChangeLog index b07c67e..720c8fb 100644 --- a/org.glite.lb.client/project/ChangeLog +++ b/org.glite.lb.client/project/ChangeLog @@ -27,3 +27,19 @@ 3.2.0-1 (lb-1.8.0-1) - added ui_host to jobstat - store purge files (to be uploaded to JP) in GLITE_LOCATION_VAR rahter then GLITE_TMP + +3.2.1-1 +- use -1 as an invalid socken number instead of 0 +- handle errors generated by gss inquire credentials correctly (#37084) +- correctly release unused credentials (#37069) and reuse connection +- handle gss errors whene receiving notifications (#35118) +- fix producer connection management (re-establishing connections) (#37074) + +w +p +w +s +- (# + + + diff --git a/org.glite.lb.client/project/version.properties b/org.glite.lb.client/project/version.properties index 1cb83fc..ed225d9 100644 --- a/org.glite.lb.client/project/version.properties +++ b/org.glite.lb.client/project/version.properties @@ -1,3 +1,3 @@ # $Header$ -module.version=3.2.0 +module.version=3.2.1 module.age=1 diff --git a/org.glite.lb.client/src/StatusAttrNames.pl b/org.glite.lb.client/src/StatusAttrNames.pl index b834d15..3f74011 100644 --- a/org.glite.lb.client/src/StatusAttrNames.pl +++ b/org.glite.lb.client/src/StatusAttrNames.pl @@ -68,4 +68,5 @@ SUSPENDED USER_TAGS REMOVE_FROM_PROXY + UI_HOST /; diff --git a/org.glite.lb.client/src/connection.c b/org.glite.lb.client/src/connection.c index 2f1e919..1c43896 100644 --- a/org.glite.lb.client/src/connection.c +++ b/org.glite.lb.client/src/connection.c @@ -33,7 +33,7 @@ int CloseConnection(edg_wll_Context ctx, int* conn_index) assert(ctx->connections->connOpened); - if (ctx->connections->connPool[cIndex].gss.sock) + if (ctx->connections->connPool[cIndex].gss.sock >= 0) ret = edg_wll_gss_close(&ctx->connections->connPool[cIndex].gss, &ctx->p_tmp_timeout); if (ctx->connections->connPool[cIndex].gsiCred != NULL) edg_wll_gss_release_cred(&ctx->connections->connPool[cIndex].gsiCred, NULL); @@ -42,6 +42,7 @@ int CloseConnection(edg_wll_Context ctx, int* conn_index) free(ctx->connections->connPool[cIndex].certfile); memset(ctx->connections->connPool + cIndex, 0, sizeof(edg_wll_ConnPool)); + ctx->connections->connPool[cIndex].gss.sock = -1; ctx->connections->connOpened--; @@ -260,14 +261,19 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse) if (acquire_cred) { + edg_wll_GssCred newcred = NULL; if (edg_wll_gss_acquire_cred_gsi( ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename, ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_key_filename, - &ctx->connections->connPool[index].gsiCred, &gss_stat)) { + &newcred, &gss_stat)) { edg_wll_SetErrorGss(ctx, "failed to load GSI credentials", &gss_stat); goto err; - } - else { + } else { + if (ctx->connections->connPool[index].gsiCred != NULL) + edg_wll_gss_release_cred(&ctx->connections->connPool[index].gsiCred,&gss_stat); + ctx->connections->connPool[index].gsiCred = newcred; + newcred = NULL; + // Credentials Acquired successfully. Storing file identification. #ifdef EDG_WLL_CONNPOOL_DEBUG printf("Cert file: %s\n", ctx->p_proxy_filename ? ctx->p_proxy_filename : ctx->p_cert_filename); @@ -282,6 +288,9 @@ int edg_wll_open(edg_wll_Context ctx, int* connToUse) } } + if (acquire_cred && ctx->connections->connPool[index].gss.context != NULL) { + edg_wll_gss_close(&ctx->connections->connPool[index].gss, &ctx->p_tmp_timeout); + } if (ctx->connections->connPool[index].gss.context == NULL) { switch (edg_wll_gss_connect(ctx->connections->connPool[index].gsiCred, ctx->connections->connPool[index].peerName, ctx->connections->connPool[index].peerPort, diff --git a/org.glite.lb.client/src/consumer.c b/org.glite.lb.client/src/consumer.c index e834012..3e1e1c5 100644 --- a/org.glite.lb.client/src/consumer.c +++ b/org.glite.lb.client/src/consumer.c @@ -286,7 +286,7 @@ int edg_wll_JobLog( j[0].attr = EDG_WLL_QUERY_ATTR_JOBID; j[0].op = EDG_WLL_QUERY_OP_EQUAL; - j[0].value.j = job; + j[0].value.j = (glite_jobid_t) job; e[0].attr = EDG_WLL_QUERY_ATTR_LEVEL; e[0].op = EDG_WLL_QUERY_OP_LESS; @@ -309,7 +309,7 @@ int edg_wll_JobStatus( j[0].attr = EDG_WLL_QUERY_ATTR_JOBID; j[0].op = EDG_WLL_QUERY_OP_EQUAL; - j[0].value.j = job; + j[0].value.j = (glite_jobid_t) job; j[1].attr = EDG_WLL_QUERY_ATTR_UNDEF; ret = edg_wll_QueryJobs(ctx,j,flags,NULL,&statesOut); @@ -383,7 +383,7 @@ int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec **job_c int i = 0, j, found = 0, error = 0; - int srvPort = 0, + unsigned int srvPort = 0, srvPortTmp; char *srvName = NULL, *srvNameTmp; diff --git a/org.glite.lb.client/src/notification.c b/org.glite.lb.client/src/notification.c index 2c6a489..440ef61 100644 --- a/org.glite.lb.client/src/notification.c +++ b/org.glite.lb.client/src/notification.c @@ -713,7 +713,7 @@ err: struct pollfd pollfds[1]; struct sockaddr_in a; int recv_sock; - size_t alen; + socklen_t alen; edg_wll_Event *event = NULL; struct timeval start_time,check_time,tv; char *event_char = NULL, *jobstat_char = NULL; diff --git a/org.glite.lb.client/src/prod_proto.c b/org.glite.lb.client/src/prod_proto.c index 4a129c9..27e765a 100644 --- a/org.glite.lb.client/src/prod_proto.c +++ b/org.glite.lb.client/src/prod_proto.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -224,11 +225,13 @@ int edg_wll_log_connect(edg_wll_Context ctx, int *conn) /* check if connection already in pool */ if ( (index = ConnectionIndex(ctx, ctx->p_destination, ctx->p_dest_port)) == -1 ) { if (ctx->connections->connOpened == ctx->connections->poolSize) - if (ReleaseConnection(ctx, NULL, 0)) + if (ReleaseConnection(ctx, NULL, 0)) { + answer = edg_wll_SetError(ctx,EAGAIN,"cannot release connection (pool size exceeded)"); goto edg_wll_log_connect_end; + } index = AddConnection(ctx, ctx->p_destination, ctx->p_dest_port); if (index < 0) { - edg_wll_SetError(ctx,EAGAIN,"connection pool size exceeded"); + answer = edg_wll_SetError(ctx,EAGAIN,"cannot add connection to pool"); goto edg_wll_log_connect_end; } #ifdef EDG_WLL_LOG_STUB @@ -251,7 +254,7 @@ int edg_wll_log_connect(edg_wll_Context ctx, int *conn) &ctx->connections->connPool[index].gsiCred, &gss_stat); /* give up if unable to acquire prescribed credentials, otherwise go on anonymously */ if (ret && ctx->p_proxy_filename) { - edg_wll_SetErrorGss(ctx, "edg_wll_gss_acquire_cred_gsi(): failed to load GSI credentials", &gss_stat); + answer = edg_wll_SetErrorGss(ctx, "edg_wll_gss_acquire_cred_gsi(): failed to load GSI credentials", &gss_stat); goto edg_wll_log_connect_err; } if (ctx->connections->connPool[index].gsiCred) @@ -272,6 +275,7 @@ int edg_wll_log_connect(edg_wll_Context ctx, int *conn) #endif /* gss_connect */ if (ctx->connections->connPool[index].gss.context == NULL) { + int opt; /* acquire gss credentials */ ret = edg_wll_gss_acquire_cred_gsi( @@ -303,6 +307,10 @@ int edg_wll_log_connect(edg_wll_Context ctx, int *conn) answer = handle_gss_failures(ctx,answer,&gss_stat,"edg_wll_gss_connect()"); goto edg_wll_log_connect_err; } + opt = 0; + setsockopt(ctx->connections->connPool[index].gss.sock,IPPROTO_TCP,TCP_CORK,(const void *) &opt,sizeof opt); + opt = 1; + setsockopt(ctx->connections->connPool[index].gss.sock,IPPROTO_TCP,TCP_NODELAY,(const void *) &opt,sizeof opt); goto edg_wll_log_connect_end; } else goto edg_wll_log_connect_end; @@ -651,7 +659,7 @@ int edg_wll_log_direct_connect(edg_wll_Context ctx, edg_wll_GssConnection *conn) edg_wll_GssStatus gss_stat; edg_wll_GssCred cred = NULL; char *host; - int port; + unsigned int port; ret = answer = 0; diff --git a/org.glite.lb.client/src/producer.c b/org.glite.lb.client/src/producer.c index 6c1be90..f07c001 100644 --- a/org.glite.lb.client/src/producer.c +++ b/org.glite.lb.client/src/producer.c @@ -86,32 +86,37 @@ int edg_wll_DoLogEvent( edg_wll_LogLine logline) { int ret = 0, answer = EAGAIN; - int conn; + int conn = -1; + int attempt = 1; edg_wll_ResetError(ctx); memset(&conn,0,sizeof(conn)); - /* connect to local-logger */ - if ((ret = edg_wll_log_connect(ctx,&conn))) { - edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_connect error"); - goto edg_wll_DoLogEvent_end; - } - - /* why? sleep(3); */ - /* send message */ - if ((ret = edg_wll_log_write(ctx,conn,logline)) == -1) { - edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_write error"); - goto edg_wll_DoLogEvent_end; - } - - /* get answer */ - if ((ret = edg_wll_log_read(ctx,conn)) == -1) { - edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_read error"); - } else { + do { + /* connect to local-logger */ + if ((ret = edg_wll_log_connect(ctx,&conn))) { + edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_connect error"); + goto edg_wll_DoLogEvent_end; + } + + /* send message */ + if ((ret = edg_wll_log_write(ctx,conn,logline)) == -1) { + answer = edg_wll_Error(ctx, NULL, NULL); + edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_write error"); + goto edg_wll_DoLogEvent_end; + } + + /* get answer */ + ret = edg_wll_log_read(ctx,conn); answer = edg_wll_Error(ctx, NULL, NULL); - } + if (ret == -1) + edg_wll_UpdateError(ctx,EDG_WLL_IL_PROTO,"edg_wll_DoLogEvent(): edg_wll_log_read error"); + + edg_wll_DoLogEvent_end: + if (ret == -1 && conn >= 0) edg_wll_log_close(ctx,conn); + + } while (++attempt <= 2 && (answer == ENOTCONN || answer == EPIPE)); -edg_wll_DoLogEvent_end: return handle_errors(ctx,answer,"edg_wll_DoLogEvent()"); } @@ -746,7 +751,7 @@ static int edg_wll_RegisterJobMaster( enum edg_wll_RegJobJobtype type, const char * jdl, const char * ns, - edg_wlc_JobId parent, + glite_jobid_const_t parent, int num_subjobs, const char * seed, edg_wlc_JobId ** subjobs) @@ -1124,7 +1129,7 @@ int edg_wll_RegisterSubjob( enum edg_wll_RegJobJobtype type, const char * jdl, const char * ns, - edg_wlc_JobId parent, + glite_jobid_const_t parent, int num_subjobs, const char * seed, edg_wlc_JobId ** subjobs) @@ -1145,7 +1150,7 @@ int edg_wll_RegisterSubjobProxy( enum edg_wll_RegJobJobtype type, const char * jdl, const char * ns, - edg_wlc_JobId parent, + glite_jobid_const_t parent, int num_subjobs, const char * seed, edg_wlc_JobId ** subjobs) diff --git a/org.glite.lb.client/src/statistics.c b/org.glite.lb.client/src/statistics.c index de12ba9..6b0fd16 100644 --- a/org.glite.lb.client/src/statistics.c +++ b/org.glite.lb.client/src/statistics.c @@ -126,7 +126,7 @@ static int set_server_name_and_port(edg_wll_Context ctx, const edg_wll_QueryRec int i = 0, j, found = 0, error = 0; - int srvPort = 0, + unsigned int srvPort = 0, srvPortTmp; char *srvName = NULL, *srvNameTmp; diff --git a/org.glite.lb.common/interface/LoggingExceptions.h b/org.glite.lb.common/interface/LoggingExceptions.h index b6d6493..faed49b 100644 --- a/org.glite.lb.common/interface/LoggingExceptions.h +++ b/org.glite.lb.common/interface/LoggingExceptions.h @@ -45,8 +45,8 @@ public: const std::string& method, int code, const std::string& exception) - : source_file(source), line(line_number), error_code(code), - std::runtime_error(formatMessage(exception, method, source, line_number)) + : std::runtime_error(formatMessage(exception, method, source, line_number)), + source_file(source), line(line_number), error_code(code) {} @@ -68,9 +68,9 @@ public: int code, const std::string& exception, const Exception &exc) - : source_file(source), line(line_number), error_code(code), - std::runtime_error(formatMessage(exception, method, source, line_number) + - exc.what()) + : std::runtime_error(formatMessage(exception, method, source, line_number) + + exc.what()), + source_file(source), line(line_number), error_code(code) { } virtual ~Exception() throw() diff --git a/org.glite.lb.common/interface/context-int.h b/org.glite.lb.common/interface/context-int.h index 54439a1..7f4f685 100644 --- a/org.glite.lb.common/interface/context-int.h +++ b/org.glite.lb.common/interface/context-int.h @@ -142,7 +142,6 @@ glite_lb_padded_struct(_edg_wll_Context,150, char **fqans; /* null-terminated list of peer's VOMS FQANs */ edg_wll_QueryRec **notif_index; void *notif_index_cols; - time_t notifDurationMax; ) diff --git a/org.glite.lb.common/interface/query_rec.h b/org.glite.lb.common/interface/query_rec.h index 84a069e..1522449 100644 --- a/org.glite.lb.common/interface/query_rec.h +++ b/org.glite.lb.common/interface/query_rec.h @@ -91,7 +91,7 @@ typedef struct _edg_wll_QueryRec { int i; /**< integer query attribute value */ char *c; /**< character query attribute value */ struct timeval t; /**< time query attribute value */ - glite_jobid_const_t j; /**< JobId query attribute value */ + glite_jobid_t j; /**< JobId query attribute value */ } value, value2; } edg_wll_QueryRec; diff --git a/org.glite.lb.common/interface/xml_parse.h b/org.glite.lb.common/interface/xml_parse.h index 61c72e0..e9d8df4 100644 --- a/org.glite.lb.common/interface/xml_parse.h +++ b/org.glite.lb.common/interface/xml_parse.h @@ -62,7 +62,10 @@ extern int edg_wll_IndexedAttrsRequestToXML(edg_wll_Context ctx, char **message) extern int edg_wll_NotifRequestToXML( edg_wll_Context ctx, const char *function, const edg_wll_NotifId notifId, const char *address, edg_wll_NotifChangeOp op, time_t validity, edg_wll_QueryRec const * const *conditions, char **message); extern int edg_wll_QuerySequenceCodeToXML(edg_wll_Context ctx, glite_jobid_const_t jobId, char **message); + +extern int edg_wll_StatsRequestToXML(edg_wll_Context,const char *,const edg_wll_QueryRec *,edg_wll_JobStatCode,int,time_t *,time_t *,char **); +extern edg_wll_ErrorCode edg_wll_ParseStatsResult(edg_wll_Context ctx, char *messageBody, time_t *from, time_t *to, float *rate, float *duration, int *res_from, int *res_to); #ifdef __cplusplus } diff --git a/org.glite.lb.common/project/ChangeLog b/org.glite.lb.common/project/ChangeLog index ecbe5ee..dbd6410 100644 --- a/org.glite.lb.common/project/ChangeLog +++ b/org.glite.lb.common/project/ChangeLog @@ -7,3 +7,12 @@ 6.1.1-1 (lb-1.7.1-1) - fixed memleaks in LB query protocol +6.1.1-2 (lb-1.7.4-1) +- rebuild wrt. downgraded security 3.1.57-1 + +6.1.1-3 (lb-1.8.0-1) +- rebuild wrt. changes in lb.build (ui_host) + +6.1.2-1 +- changed unused socket number from 0 to -1 + diff --git a/org.glite.lb.common/src/connpool.c b/org.glite.lb.common/src/connpool.c index 8cec59a..e9547c4 100644 --- a/org.glite.lb.common/src/connpool.c +++ b/org.glite.lb.common/src/connpool.c @@ -236,6 +236,7 @@ void edg_wll_poolFree() { /** Allocate memory for arrays within the edg_wll_Connections structure */ edg_wll_Connections* edg_wll_initConnections() { + int i; #ifdef EDG_WLL_CONNPOOL_DEBUG #ifdef GLITE_LB_THREADED @@ -256,6 +257,9 @@ edg_wll_Connections* edg_wll_initConnections() { connectionsHandle.connPool = (edg_wll_ConnPool *) calloc(connectionsHandle.poolSize, sizeof(edg_wll_ConnPool)); + for (i=0; i