Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000338 [Resin] minor always 08-08-05 00:00 11-30-05 14:42
Reporter ferg View Status public  
Assigned To
Priority normal Resolution fixed  
Status closed   Product Version 3.0.14
Summary 0000338: mod_caucho debugging enhancements
Description RSN-382
(rep by Branko Gracnar)


I've composed a little better debugging of mod_caucho. It applies
against 3.0.14 and it should work also with older versions.
Additional Information
Attached Files

- Relationships

- Notes
(0000386)
ferg
08-08-05 00:00


diff -ur resin-pro-3.0.14.orig/modules/c/src/apache1/mod_caucho.c resin-pro-3.0.14/modules/c/src/apache1/mod_caucho.c
--- resin-pro-3.0.14.orig/modules/c/src/apache1/mod_caucho.c 2005-05-16 19:39:44.000000000 +0200
+++ resin-pro-3.0.14/modules/c/src/apache1/mod_caucho.c 2005-08-08 18:50:44.000000000 +0200
@@ -127,15 +127,28 @@
   va_list args;
 
   va_start(args, format);
- vsprintf(buf, format, args);
+ vsnprintf(buf, sizeof(buf), format, args);
   va_end(args);
 
- LOG(("%s\n", buf));
+ LOG(("ERROR: %s", buf));
 
   config->error = cse_strdup(config->p, buf);
 }
 
 void
+cse_err(char *format, ...)
+{
+ char buf[BUF_LENGTH];
+ va_list args;
+
+ va_start(args, format);
+ vsnprintf(buf, sizeof(buf), format, args);
+ va_end(args);
+
+ LOG(("ERROR: %s", buf));
+}
+
+void
 cse_set_socket_cleanup(int socket, void *pool)
 {
   LOG(("set cleanup %d\n", socket));
diff -ur resin-pro-3.0.14.orig/modules/c/src/apache2/mod_caucho.c resin-pro-3.0.14/modules/c/src/apache2/mod_caucho.c
--- resin-pro-3.0.14.orig/modules/c/src/apache2/mod_caucho.c 2005-06-28 15:13:16.000000000 +0200
+++ resin-pro-3.0.14/modules/c/src/apache2/mod_caucho.c 2005-08-08 18:50:54.000000000 +0200
@@ -37,6 +37,12 @@
 #include <stdlib.h>
 #include <errno.h>
 
+#ifdef DEBUG
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+#endif
+
 #include "cse.h"
 #include "version.h"
 
@@ -63,20 +69,32 @@
 cse_log(char *fmt, ...)
 {
 #ifdef DEBUG
- va_list args;
+ va_list args;
+ char time_str[32];
+ time_t t;
+ int pid = 0;
+ unsigned long int thread = 0;
+
+ /** get (process, thread) id */
+ pid = (int) getpid();
+#if APR_HAS_THREADS
+ thread = (unsigned long int) apr_os_thread_current();
+#endif
 
- FILE *file = fopen("/tmp/log", "a+");
+ /** wipe strings */
+ memset(time_str, '\0', sizeof(time_str));
 
- if (file) {
- va_start(args, fmt);
- vfprintf(file, fmt, args);
- va_end(args);
- fclose(file);
- }
+ /* calculate time && print it into log */
+ time(&t);
+ strftime(time_str, (size_t) sizeof(time_str), "[%m/%b/%Y:%H:%M:%S %z]", localtime(&t));
+ fprintf(stderr, "%s %d_%ld: ", time_str, pid, thread);
+
+ va_start(args, fmt);
+ vfprintf(stderr, fmt, args);
+ va_end(args);
 
- va_start(args,fmt);
- vfprintf(stderr, fmt, args);
- va_end(args);
+ /* flush log */
+ fflush(stderr);
 #endif
 }
 
@@ -123,14 +141,25 @@
   va_list args;
 
   va_start(args, format);
- vsprintf(buf, format, args);
+ vsnprintf(buf, sizeof(buf), format, args);
   va_end(args);
 
- LOG(("%s\n", buf));
+ LOG(("ERROR: %s", buf));
 
   config->error = cse_strdup(config->p, buf);
 }
 
+void cse_err (char *format, ...) {
+ char buf[BUF_LENGTH];
+ va_list args;
+
+ va_start(args, format);
+ vsnprintf(buf, sizeof(buf), format, args);
+ va_end(args);
+
+ LOG(("ERROR: %s", buf));
+}
+
 void
 cse_set_socket_cleanup(int socket, void *pool)
 {
@@ -225,7 +254,7 @@
 static config_t *
 cse_get_module_config(request_rec *r)
 {
- config_t *config;
+ config_t *config = NULL;
 
   if (r->per_dir_config) {
     config = (config_t *) ap_get_module_config(r->per_dir_config,
@@ -627,16 +656,16 @@
 
     code = cse_read_byte(s);
 
- LOG(("code %c\n", code));
+ LOG(("send_data(), file %s, line %d: code %c\n", __FILE__, __LINE__, code));
     switch (code) {
     case HMUX_CHANNEL:
       channel = hmux_read_len(s);
- LOG(("channel %d\n", channel));
+ LOG(("send_data(), file %s, line %d: channel %d\n", __FILE__, __LINE__, channel));
       break;
       
     case HMUX_ACK:
       channel = hmux_read_len(s);
- LOG(("ack %d\n", channel));
+ LOG(("send_data(), file %s, line %d: ack %d\n", __FILE__, __LINE__, channel));
       return code;
       
     case HMUX_STATUS:
@@ -732,7 +761,7 @@
 
   code = send_data(s, r);
 
- LOG(("return code %c\n", code));
+ LOG(("write_request(), file %s, line %d: return code %c\n", __FILE__, __LINE__, code));
 
   return code;
 }
@@ -752,6 +781,8 @@
   char *ip;
   srun_t *srun;
 
+ LOG(("caucho_request(): file %s, line %d: startup.\n", __FILE__, __LINE__));
+
   if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK)))
     return retval;
 
@@ -770,15 +801,15 @@
               now);
   }
     
- LOG(("session index: %d\n", session_index));
+ LOG(("caucho_request(), file %s, line %d: session index: %d\n", __FILE__, __LINE__, session_index));
   if (! host) {
- LOG(("no host: %p\n", host));
+ ERR(("caucho_request(), file %s, line %d: no host: %p\n", __FILE__, __LINE__, host));
     return HTTP_SERVICE_UNAVAILABLE;
   }
   else if (! cse_open_connection(&s, &host->cluster,
                  session_index, backup_index,
                  now, r->pool)) {
- LOG(("no connection: %p\n", host));
+ ERR(("caucho_request(), file %s, line %d: no connection: %p\n", __FILE__, __LINE__, host));
     return HTTP_SERVICE_UNAVAILABLE;
   }
 
@@ -800,10 +831,14 @@
   else
     cse_close(&s, "no reuse");
 
- if (code != HMUX_QUIT && code != HMUX_EXIT)
+ if (code != HMUX_QUIT && code != HMUX_EXIT) {
+ ERR(("caucho_request(), file %s, line %d: code(%d) != HMUX_QUIT(%d) && code(%d) != HMUX_EXIT(%d)\n", __FILE__, __LINE__, code, HMUX_QUIT, code, HMUX_EXIT));
     return HTTP_SERVICE_UNAVAILABLE;
- else if (r->status == HTTP_SERVICE_UNAVAILABLE)
+ }
+ else if (r->status == HTTP_SERVICE_UNAVAILABLE) {
+ ERR(("caucho_request(), file %s, line %d: r->status(%d) == HTTP_SERVICE_UNAVAILABLE\n", __FILE__, __LINE__, r->status));
     return HTTP_SERVICE_UNAVAILABLE;
+ }
   else
     return OK;
 }
@@ -857,7 +892,7 @@
 
       /* This needs to be close, because cse_open doesn't use recycle. */
       cse_close(&s, "caucho-status");
- LOG(("close\n"));
+ LOG(("jvm_status(), file %s, line %d: close\n", __FILE__, __LINE__));
 
       ap_rprintf(r, "<td align=right>%d</td><td align=right>%d</td>",
          srun->active_sockets, pool_count);
@@ -1032,7 +1067,7 @@
   if (config == NULL || ! uri)
     return DECLINED;
  
- LOG(("[%d] host %s\n", getpid(), host_name ? host_name : "null"));
+ LOG(("cse_dispatch(), file %s, line %d: [%d] host %s\n", __FILE__, __LINE__, getpid(), host_name ? host_name : "null"));
   
 
   len = strlen(uri);
@@ -1049,7 +1084,7 @@
   host = cse_match_request(config, host_name, port, uri, 0, now);
   
   if (host || (r->handler && ! strcmp(r->handler, "caucho-request"))) {
- LOG(("[%d] match %s:%s\n", getpid(), host_name ? host_name : "null", uri));
+ LOG(("cse_dispatch(), file %s, line %d: [%d] match %s:%s\n", __FILE__, __LINE__, getpid(), host_name ? host_name : "null", uri));
 
     return caucho_request(r, config, host, now);
   }
diff -ur resin-pro-3.0.14.orig/modules/c/src/common/config.c resin-pro-3.0.14/modules/c/src/common/config.c
--- resin-pro-3.0.14.orig/modules/c/src/common/config.c 2005-07-01 18:19:17.000000000 +0200
+++ resin-pro-3.0.14/modules/c/src/common/config.c 2005-08-08 18:50:38.000000000 +0200
@@ -119,7 +119,7 @@
   loc->is_exact = is_exact;
   loc->ignore = ignore;
 
- LOG(("loc %s %s %x %s\n",
+ LOG(("cse_add_unique_location(), file %s, line %d: loc %s %s %x %s\n", __FILE__, __LINE__,
        loc->prefix ? loc->prefix : "(null)",
        loc->suffix ? loc->suffix : "(null)",
        loc->next,
@@ -156,7 +156,7 @@
 
   app->context_path = cse_strdup(pool, context_path);
 
- LOG(("new web-app host:%s path:%s\n", host->name, app->context_path));
+ LOG(("cse_add_web_app(), file %s, line %d: new web-app host:%s path:%s\n", __FILE__, __LINE__, host->name, app->context_path));
 
   return applications;
 }
@@ -308,7 +308,7 @@
   host->port = port;
   host->next = config->hosts;
   config->hosts = host;
- LOG(("cse_add_host_config %s\n", host_name));
+ LOG(("cse_add_host_config(), file %s, line %d: %s\n", __FILE__, __LINE__, host_name));
 
   return host;
 }
@@ -363,7 +363,7 @@
       location_t *loc = app->locations;
     
       for (; loc; loc = loc->next) {
- LOG(("cfg host:%s%s prefix:%s suffix:%s next:%x\n",
+ LOG(("cse_log_config(), file %s, line %d: cfg host:%s%s prefix:%s suffix:%s next:%x\n", __FILE__, __LINE__,
          host->name,
          app->context_path ? app->context_path : "/",
          loc->prefix ? loc->prefix : "null",
@@ -429,7 +429,7 @@
   host->canonical = host;
   *p_is_change = is_change;
 
- LOG(("hmux config %s:%d\n", host->name, host->port));
+ LOG(("read_config(), file %s, line %d: hmux config %s:%d\n", __FILE__, __LINE__, host->name, host->port));
   
   while (1) {
     code = cse_read_byte(s);
@@ -441,7 +441,7 @@
     int port = 0;
     int ch;
     
- LOG(("hmux host %s\n", buffer));
+ LOG(("read_config(), file %s, line %d: hmux host %s\n", __FILE__, __LINE__, buffer));
 
     for (p = 0; (ch = buffer[p]); p++) {
       if (ch == ':') {
@@ -461,7 +461,7 @@
       canonical = cse_create_host(config, buffer, port);
       
       host->canonical = canonical;
- LOG(("hmux set canonical %s:%d -> %s:%d\n",
+ LOG(("read_config(), file %s, line %d: hmux set canonical %s:%d -> %s:%d\n", __FILE__, __LINE__,
            host->name, host->port,
            buffer, port));
     }
@@ -474,7 +474,7 @@
       }
     
       if (hmux_read_string(s, buffer, sizeof(buffer)) >= 0) {
- LOG(("hmux web-app %s\n", buffer));
+ LOG(("read_config(), file %s, line %d: hmux web-app %s\n", __FILE__, __LINE__, buffer));
     web_app = cse_add_application(pool, host, web_app, buffer);
     
     cse_add_match_pattern(pool, web_app, "/WEB-INF/*");
@@ -484,28 +484,28 @@
     
     case HMUX_DISPATCH_MATCH:
       if (hmux_read_string(s, buffer, sizeof(buffer)) > 0) {
- LOG(("hmux match %s\n", buffer));
+ LOG(("read_config(), file %s, line %d: hmux match %s\n", __FILE__, __LINE__, buffer));
     cse_add_match_pattern(pool, web_app, buffer);
       }
       break;
     
     case HMUX_DISPATCH_IGNORE:
       if (hmux_read_string(s, buffer, sizeof(buffer)) > 0) {
- LOG(("hmux ignore %s\n", buffer));
+ LOG(("read_config(), file %s, line %d: hmux ignore %s\n", __FILE__, __LINE__, buffer));
     cse_add_ignore_pattern(pool, web_app, buffer);
       }
       break;
 
     case HMUX_DISPATCH_ETAG:
       hmux_read_string(s, etag, sizeof(etag));
- LOG(("hmux etag %s\n", etag));
+ LOG(("read_config(): file %s, line %d: hmux etag %s\n", __FILE__, __LINE__, etag));
       break;
 
     case HMUX_DISPATCH_NO_CHANGE:
       host->canonical = old_canonical;
       cse_skip(s, hmux_read_len(s));
       
- LOG(("hmux no-change %s\n", host->etag));
+ LOG(("read_config(), file %s, line %d: hmux no-change %s\n", __FILE__, __LINE__, host->etag));
       *p_is_change = is_change;
       break;
     
@@ -514,7 +514,7 @@
 
       ch = cse_read_byte(s);
       hmux_read_string(s, value, sizeof(value));
- LOG(("hmux header %s: %s\n", buffer, value));
+ LOG(("read_config(), file %s, line %d: hmux header %s: %s\n", __FILE__, __LINE__, buffer, value));
       
       if (ch == HMUX_STRING) {
     if (! strcmp(buffer, "live-time"))
@@ -533,7 +533,7 @@
     case HMUX_CLUSTER:
       hmux_read_string(s, buffer, sizeof(buffer));
     
- LOG(("hmux cluster %s\n", buffer));
+ LOG(("read_config(), file %s line %d: hmux cluster %s\n", __FILE__, __LINE__, buffer));
       break;
     
     case HMUX_SRUN:
@@ -543,7 +543,7 @@
 
     hmux_read_string(s, buffer, sizeof(buffer));
     
- LOG(("hmux srun %s\n", buffer));
+ LOG(("read_config(), file %s, line %d: hmux srun %s\n", __FILE__, __LINE__, buffer));
 
     p = strchr(buffer, ':');
     if (p) {
@@ -592,7 +592,7 @@
       return code == HMUX_QUIT;
 
     default:
- LOG(("hmux unknown %d\n", code));
+ LOG(("read_config(), file %s, line %d: hmux unknown %d\n", __FILE__, __LINE__, code));
       
       if (pool)
     cse_free_pool(pool);
@@ -752,7 +752,7 @@
     int ch;
     
     hmux_read_string(&s, buffer, sizeof(buffer));
- LOG(("hmux host %s\n", buffer));
+ LOG(("read_all_config_impl(), file %s, line %d: hmux host %s\n", __FILE__, __LINE__, buffer));
 
     for (p = 0; (ch = buffer[p]); p++) {
       if (ch == ':') {
@@ -773,13 +773,13 @@
       ch = cse_read_byte(&s);
       hmux_read_string(&s, value, sizeof(value));
       if (ch == HMUX_STRING) {
- LOG(("hmux header %s: %s\n", buffer, value));
+ LOG(("read_all_config_impl(), file %s, line %d: hmux header %s: %s\n", __FILE__, __LINE__, buffer, value));
       }
       break;
 
     default:
       hmux_read_string(&s, value, sizeof(value));
- LOG(("hmux value %c: %s\n", code, buffer));
+ LOG(("read_all_config_impl(), file %s, line %d: hmux value %c: %s\n", __FILE__, __LINE__, code, buffer));
       break;
     }
   }
@@ -851,7 +851,7 @@
     return 1;
   }
   else {
- LOG(("can't open any connections\n"));
+ LOG(("cse_update_host_from_resin(), file %s, line %d: can't open any connections\n", __FILE__, __LINE__));
   }
 
   return 0;
@@ -863,7 +863,7 @@
 void
 cse_init_config(config_t *config)
 {
- LOG(("initializing\n"));
+ LOG(("cse_init_config(), file %s, line %d: initializing\n", __FILE__, __LINE__));
 
   if (! config->p)
     config->p = cse_create_pool(config);
@@ -911,7 +911,7 @@
 
   if (! config->lock) {
     config->lock = cse_create_lock(config);
- LOG(("config lock %p\n", config->lock));
+ LOG(("cse_init_config(), file %s, line %d: config lock %p\n", __FILE__, __LINE__, config->lock));
     config->config_lock = cse_create_lock(config);
   }
 
@@ -1186,7 +1186,7 @@
     if (strlen(app_ptr->context_path) < best_len)
       continue;
 
- LOG(("app-match host:%s%s with host:%s uri:%s\n",
+ LOG(("cse_is_match(), file %s, line %d: app-match host:%s%s with host:%s uri:%s\n", __FILE__, __LINE__,
          host->name,
          app_ptr->context_path ? app_ptr->context_path : "",
          host_name, uri));
@@ -1202,7 +1202,7 @@
 
   is_match = 0;
   for (loc = app->locations; loc; loc = loc->next) {
- LOG(("match host:%s%s prefix:%s suffix:%s with host:%s uri:%s next:%x ignore:%d exact:%d\n",
+ LOG(("cse_is_match(), file %s, line %d: match host:%s%s prefix:%s suffix:%s with host:%s uri:%s next:%x ignore:%d exact:%d\n", __FILE__, __LINE__,
          host->name,
          app->context_path ? app->context_path : "null",
          loc->prefix ? loc->prefix : "null",
@@ -1320,8 +1320,8 @@
     entry->host = 0;
   }
 
- LOG(("cse_match_request entry %s %s match:%s\n", host, uri, (match_host != 0) ? "yes" : "no"));
-
+ LOG(("cse_match_request(), file %s, line %d: entry %s %s match:%s\n", __FILE__, __LINE__, host, uri, (match_host != 0) ? "yes" : "no"));
+
   entry->host = strdup(host ? host : "");
   entry->uri = strdup(uri);
   entry->port = port;
diff -ur resin-pro-3.0.14.orig/modules/c/src/common/memory.c resin-pro-3.0.14/modules/c/src/common/memory.c
--- resin-pro-3.0.14.orig/modules/c/src/common/memory.c 2005-03-05 22:18:39.000000000 +0100
+++ resin-pro-3.0.14/modules/c/src/common/memory.c 2005-08-08 18:50:38.000000000 +0200
@@ -57,8 +57,8 @@
   memset(pool, 0, sizeof(mem_pool_t));
   pool->config = config;
   pool->lock = cse_create_lock(config);
- LOG(("memory lock %p\n", pool->lock));
- LOG(("create pool %p\n", pool));
+ LOG(("cse_create_pool(), file %s, line %d: memory lock %p\n", __FILE__, __LINE__, pool->lock));
+ LOG(("cse_create_pool(), file %s, line %d: create pool %p\n", __FILE__, __LINE__, pool));
 
   return pool;
 }
@@ -113,7 +113,7 @@
   pool_block_t *ptr;
   pool_block_t *next;
 
- LOG(("free pool %p\n", pool));
+ LOG(("cse_free_pool(), file %s, line %d: free pool %p\n", __FILE__, __LINE__, pool));
 
   cse_lock(pool->lock);
 
diff -ur resin-pro-3.0.14.orig/modules/c/src/common/stream.c resin-pro-3.0.14/modules/c/src/common/stream.c
--- resin-pro-3.0.14.orig/modules/c/src/common/stream.c 2005-06-25 17:24:06.000000000 +0200
+++ resin-pro-3.0.14/modules/c/src/common/stream.c 2005-08-08 18:50:38.000000000 +0200
@@ -115,7 +115,7 @@
   if (! ssl) {
     close(stream->socket);
     stream->socket = -1;
- LOG(("can't allocate ssl\n"));
+ ERR(("ssl_open(), file %s, line %d: can't allocate ssl\n", __FILE__, __LINE__));
     return 0;
   }
   
@@ -125,11 +125,11 @@
     closesocket(stream->socket);
     stream->socket = -1;
     SSL_free(ssl);
- LOG(("can't connect with ssl\n"));
+ ERR(("ssl_open(), file %s, line %d: can't connect with ssl\n", __FILE__, __LINE__));
     return 0;
   }
 
- LOG(("Connect with ssl %d\n", stream->socket));
+ LOG(("ssl_open(), file %s, line %d: Connect with ssl %d\n", __FILE__, __LINE__, stream->socket));
   
   stream->ssl = ssl;
   
@@ -184,7 +184,7 @@
   s->socket = -1;
   
   if (socket >= 0) {
- LOG(("close %d %s\n", socket, msg));
+ LOG(("cse_close(), file %s, line %d: close %d %s\n", __FILE__, __LINE__, socket, msg));
 
     cse_kill_socket_cleanup(socket, s->web_pool);
 
@@ -207,7 +207,7 @@
   sock = socket(AF_INET, SOCK_STREAM, 0);
 
   if (sock == INVALID_SOCKET) {
- LOG(("mod_caucho can't create socket.\n"));
+ ERR(("cse_connect(), file %s, line %d: mod_caucho can't create socket.\n", __FILE__, __LINE__));
     return -1; /* bad socket */
   }
 
@@ -235,7 +235,7 @@
 
   is_nonblock = 0;
   ioctlsocket(sock, FIONBIO, &is_nonblock);
- LOG(("connect %d\n", sock));
+ LOG(("cse_connect(), file %s, line %d: connect %d\n", __FILE__, __LINE__, sock));
 
   return sock;
 }
@@ -255,7 +255,7 @@
   sock = socket(AF_INET, SOCK_STREAM, 0);
 
   if (sock < 0) {
- LOG(("mod_caucho can't create socket.\n"));
+ ERR(("cse_connect(), file %s, line %d: mod_caucho can't create socket.\n", __FILE__, __LINE__));
     return -1; /* bad socket */
   }
 
@@ -273,7 +273,7 @@
     return sock;
   }
   else if (errno != EWOULDBLOCK && errno != EINPROGRESS) {
- LOG(("connect quickfailed %x %d %d\n", sin->sin_addr.s_addr,
+ ERR(("cse_connect(), file %s, line %d: connect quickfailed %x %d %d\n", __FILE__, __LINE__, sin->sin_addr.s_addr,
      ntohs(sin->sin_port), errno));
     
     close(sock);
@@ -281,7 +281,7 @@
     return -1;
   }
   else if (select(sock + 1, 0, &write_fds, 0, &timeout) <= 0) {
- LOG(("timeout %x %d %d\n", sin->sin_addr.s_addr,
+ ERR(("cse_connect(), file %s, line %d: timeout %x %d %d\n", __FILE__, __LINE__, sin->sin_addr.s_addr,
      ntohs(sin->sin_port), errno));
 
     fcntl(sock, F_SETFL, flags);
@@ -293,7 +293,7 @@
   else if (! FD_ISSET(sock, &write_fds) ||
            getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &len) < 0 ||
            error) {
- LOG(("connect failed %x %d %d\n", sin->sin_addr.s_addr,
+ ERR(("cse_connect(), file %s, line %d: connect failed %x %d %d\n", __FILE__, __LINE__, sin->sin_addr.s_addr,
      ntohs(sin->sin_port), errno));
     close(sock);
 
@@ -302,7 +302,7 @@
   else {
     fcntl(sock, F_SETFL, flags);
 
- LOG(("connect %x:%d -> %d\n",
+ LOG(("cse_connect(), file %s, line %d: connect %x:%d -> %d\n", __FILE__, __LINE__,
          sin->sin_addr.s_addr, ntohs(sin->sin_port), sock));
          
     return sock;
@@ -319,7 +319,7 @@
   sock = socket(AF_INET, SOCK_STREAM, 0);
 
   if (sock < 0) {
- LOG(("mod_caucho can't create socket.\n"));
+ ERR(("cse_connect_wait(), file %s, line %d: mod_caucho can't create socket.\n", __FILE__, __LINE__));
     return -1; /* bad socket */
   }
   
@@ -327,7 +327,7 @@
     return sock;
   }
   
- LOG(("cse_connect_wait can't connect %x %d %d\n", sin->sin_addr.s_addr,
+ ERR(("cse_connect_wait(), file %s, line %d: can't connect %x %d %d\n", __FILE__, __LINE__, sin->sin_addr.s_addr,
        ntohs(sin->sin_port), errno));
 
   closesocket(sock);
@@ -374,7 +374,7 @@
     s->socket = cse_connect(&sin, srun);
 
   if (s->socket < 0) {
- LOG(("open new failed %x:%d\n",
+ ERR(("cse_open(), file %s, line %d: open new failed %x:%d\n", __FILE__, __LINE__,
      s->socket, *srun->host, srun->port));
     return 0;
   }
@@ -394,10 +394,10 @@
 #else
     srun->send_buffer_size = 16 * 1024;
 #endif
- LOG(("send buffer size %d\n", srun->send_buffer_size));
+ LOG(("cse_open(), file %s, line %d: send buffer size %d\n", __FILE__, __LINE__, srun->send_buffer_size));
   }
   
- LOG(("open new connection %d %x:%d\n", s->socket, *srun->host, srun->port));
+ LOG(("cse_open(), file %s, line %d: open new connection %d %x:%d\n", __FILE__, __LINE__, s->socket, *srun->host, srun->port));
 
   return srun->open(s);
 }
@@ -452,7 +452,7 @@
 
   /* flush the buffer */
   if (s->write_length > 0) {
- LOG(("write %d %d\n", s->socket, s->write_length));
+ LOG(("cse_fill_buffer(), file %s, line %d: write %d %d\n", __FILE__, __LINE__, s->socket, s->write_length));
 
     /* config read/save has no cluster_srun */
     if (s->cluster_srun)
@@ -814,7 +814,7 @@
   config_t *config = cluster->config;
   int i;
 
- LOG(("adding host %s:%d\n", hostname, port));
+ LOG(("cse_add_srun(), file %s, line %d: adding host %s:%d\n", __FILE__, __LINE__, hostname, port));
   
   srun = malloc(sizeof(srun_t));
   memset(srun, 0, sizeof(srun_t));
@@ -856,13 +856,13 @@
         srun->close = ssl_close;
       }
       else {
- ERR(("can't initialize ssl"));
+ ERR(("cse_add_srun(), file %s, line %d: can't initialize ssl", __FILE__, __LINE__));
       }
     }
 #endif
 
     srun->lock = cse_create_lock(config);
- LOG(("srun lock %x\n", srun->lock));
+ LOG(("cse_add_srun(), file %s, line %d: srun lock %x\n", __FILE__, __LINE__, srun->lock));
     
     return srun;
   }
@@ -958,7 +958,7 @@
   
   srun->srun->is_dead = 0;
   
- LOG(("reopen %d\n", s->socket));
+ LOG(("cse_reuse(), file %s, line %d: reopen %d\n", __FILE__, __LINE__, s->socket));
 }
 
 /**
@@ -989,7 +989,7 @@
       return;
     
     srun->conn_tail = next_tail;
- LOG(("closing idle socket:%d\n", conn->socket));
+ LOG(("cse_close_idle(), file %s, line %d: closing idle socket:%d\n", __FILE__, __LINE__, conn->socket));
     srun->close(conn->socket, conn->ssl);
   }
 }
@@ -1026,7 +1026,7 @@
       srun->conn_pool[head].last_time = now;
       srun->conn_head = next_head;
       cse_unlock(srun->lock);
- LOG(("recycle %d\n", socket));
+ LOG(("cse_recycle(), file %s, line %d: recycle %d\n", __FILE__, __LINE__, socket));
       return;
     }
   }
@@ -1034,7 +1034,7 @@
   cse_unlock(srun->lock);
   
   if (socket >= 0) {
- LOG(("close2 %d update1:%d update2:%d max-sock:%d\n",
+ LOG(("cse_recycle(), file %s, line %d: close2 %d update1:%d update2:%d max-sock:%d\n", __FILE__, __LINE__,
          socket, s->config->update_count, s->update_count,
          srun ? srun->max_sockets : -1));
     
@@ -1054,7 +1054,7 @@
        tail = (tail + 1) % CONN_POOL_SIZE) {
     struct conn_t *conn = &srun->conn_pool[tail];
     srun->close(conn->socket, conn->ssl);
- LOG(("close timeout %d\n", srun->conn_pool[tail]));;
+ LOG(("close_srun(), file %s, line %d: close timeout %d\n", __FILE__, __LINE__, srun->conn_pool[tail]));
   }
   srun->conn_head = srun->conn_tail = 0;
   
@@ -1072,7 +1072,7 @@
   int next_head;
   srun_t *srun = cluster_srun->srun;
 
- LOG(("reuse head:%d tail:%d\n", srun->conn_head, srun->conn_tail));
+ LOG(("cse_reuse_socket(), file %s, line %d: reuse head:%d tail:%d\n", __FILE__, __LINE__, srun->conn_head, srun->conn_tail));
 
   if (! srun || srun->conn_head == srun->conn_tail)
     return 0;
@@ -1088,7 +1088,7 @@
     conn = &srun->conn_pool[next_head];
     
     if (conn->last_time + srun->live_time < now) {
- LOG(("closing idle socket:%d\n", conn->socket));
+ LOG(("cse_reuse_socket(), file %s, line %d: closing idle socket:%d\n", __FILE__, __LINE__, conn->socket));
       srun->close(conn->socket, conn->ssl);
     }
     else {
 

- Issue History
Date Modified Username Field Change
08-08-05 00:00 ferg New Issue
11-30-05 00:00 administrator Fixed in Version  => 3.0.15
11-30-05 14:42 ferg Status resolved => closed


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker