Browse Source

remove debug fprintfs used to catch a bug

master
Dirk Engling 3 months ago
parent
commit
6ae819ae10
  1. 9
      opentracker.c
  2. 6
      ot_http.c
  3. 15
      ot_mutex.c

9
opentracker.c

@ -217,11 +217,9 @@ static void handle_write( const int64 sock ) {
chunked = 1; chunked = 1;
for( i = 0; i < cookie->batches; ++i ) { for( i = 0; i < cookie->batches; ++i ) {
fprintf(stderr, "handle_write inspects batch %zu of %zu (bytes left: %llu)\n", i, cookie->batches, cookie->batch[i].bytesleft);
if( cookie->batch[i].bytesleft ) { if( cookie->batch[i].bytesleft ) {
int64 res = iob_send( sock, cookie->batch + i ); int64 res = iob_send( sock, cookie->batch + i );
fprintf(stderr, "handle_write yields res %lld when trying to iob_send\n", res);
if( res == -3 ) { if( res == -3 ) {
handle_dead( sock ); handle_dead( sock );
return; return;
@ -237,13 +235,10 @@ static void handle_write( const int64 sock ) {
} }
/* In a chunked transfer after all batches accumulated have been sent, wait for the next one */ /* In a chunked transfer after all batches accumulated have been sent, wait for the next one */
if( chunked ) { if( chunked )
fprintf( stderr, "handle_write is STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER => dont want write on sock %lld\n", sock);
io_dontwantwrite( sock ); io_dontwantwrite( sock );
} else { else
fprintf( stderr, "handle_write is STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER => handle dead on sock %lld\n", sock);
handle_dead( sock ); handle_dead( sock );
}
} }
static void handle_accept( const int64 serversocket ) { static void handle_accept( const int64 serversocket ) {

6
ot_http.c

@ -144,8 +144,6 @@ ssize_t http_sendiovecdata( const int64 sock, struct ot_workstruct *ws, int iove
cookie->flag &= ~STRUCT_HTTP_FLAG_WAITINGFORTASK; cookie->flag &= ~STRUCT_HTTP_FLAG_WAITINGFORTASK;
} }
fprintf(stderr, "http_sendiovecdata sending %d iovec entries found cookie->batch == %p\n", iovec_entries, cookie->batch);
if( iovec_entries ) { if( iovec_entries ) {
if( cookie->flag & STRUCT_HTTP_FLAG_GZIP ) if( cookie->flag & STRUCT_HTTP_FLAG_GZIP )
@ -184,7 +182,6 @@ fprintf(stderr, "http_sendiovecdata sending %d iovec entries found cookie->batch
for( i=0; i<iovec_entries; ++i ) { for( i=0; i<iovec_entries; ++i ) {
/* If the current batch's limit is reached, try to reallocate a new batch to work on */ /* If the current batch's limit is reached, try to reallocate a new batch to work on */
if( current->bytesleft > OT_BATCH_LIMIT ) { if( current->bytesleft > OT_BATCH_LIMIT ) {
fprintf(stderr, "http_sendiovecdata found batch above limit: %llu\n", current->bytesleft);
io_batch * new_batch = realloc( cookie->batch, (cookie->batches + 1) * sizeof(io_batch) ); io_batch * new_batch = realloc( cookie->batch, (cookie->batches + 1) * sizeof(io_batch) );
if( new_batch ) { if( new_batch ) {
cookie->batch = new_batch; cookie->batch = new_batch;
@ -192,7 +189,6 @@ fprintf(stderr, "http_sendiovecdata found batch above limit: %llu\n", current->b
iob_init_autofree(current ,0); iob_init_autofree(current ,0);
} }
} }
fprintf(stderr, "http_sendiovecdata calling iob_addbuf_free with %zd\n", iovector[i].iov_len);
iob_addbuf_free( current, iovector[i].iov_base, iovector[i].iov_len ); iob_addbuf_free( current, iovector[i].iov_base, iovector[i].iov_len );
} }
free( iovector ); free( iovector );
@ -201,7 +197,6 @@ fprintf(stderr, "http_sendiovecdata calling iob_addbuf_free with %zd\n", iovecto
} }
if ((cookie->flag & STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER) && cookie->batch && !is_partial) { if ((cookie->flag & STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER) && cookie->batch && !is_partial) {
fprintf(stderr, "http_sendiovecdata adds a terminating 0 size buffer to batch\n");
current = cookie->batch + cookie->batches - 1; current = cookie->batch + cookie->batches - 1;
iob_addbuf(current, "0\r\n\r\n", 5); iob_addbuf(current, "0\r\n\r\n", 5);
cookie->flag &= ~STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER; cookie->flag &= ~STRUCT_HTTP_FLAG_CHUNKED_IN_TRANSFER;
@ -210,7 +205,6 @@ fprintf(stderr, "http_sendiovecdata adds a terminating 0 size buffer to batch\n"
/* writeable sockets timeout after 10 minutes */ /* writeable sockets timeout after 10 minutes */
taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND ); taia_now( &t ); taia_addsec( &t, &t, OT_CLIENT_TIMEOUT_SEND );
io_timeout( sock, t ); io_timeout( sock, t );
fprintf (stderr, "http_sendiovecdata marks socket %lld as wantwrite\n", sock);
io_wantwrite( sock ); io_wantwrite( sock );
return 0; return 0;
} }

15
ot_mutex.c

@ -205,14 +205,12 @@ int mutex_workqueue_pushchunked(ot_taskid taskid, struct iovec *iovec) {
for (task = tasklist; task; task = task->next) for (task = tasklist; task; task = task->next)
if (task->taskid == taskid) { if (task->taskid == taskid) {
if( iovec ) { if( iovec ) {
fprintf(stderr, "mutex_workqueue_pushchunked pushing on taskid %lu\n", taskid); if (iovec_append(&task->iovec_entries, &task->iovec, iovec) )
if (!iovec_append(&task->iovec_entries, &task->iovec, iovec) ) task->tasktype = TASK_DONE_PARTIAL;
return -1; else
task->tasktype = TASK_DONE_PARTIAL; task = NULL;
} else { } else
fprintf(stderr, "mutex_workqueue_pushchunked finished taskid %lu\n", taskid);
task->tasktype = TASK_DONE; task->tasktype = TASK_DONE;
}
break; break;
} }
@ -220,8 +218,6 @@ fprintf(stderr, "mutex_workqueue_pushchunked finished taskid %lu\n", taskid);
pthread_mutex_unlock( &tasklist_mutex ); pthread_mutex_unlock( &tasklist_mutex );
io_trywrite( g_self_pipe[1], &byte, 1 ); io_trywrite( g_self_pipe[1], &byte, 1 );
if(!task)
fprintf(stderr, "mutex_workqueue_pushchunked taskid %lu not found\n", taskid);
/* Indicate whether the worker has to throw away results */ /* Indicate whether the worker has to throw away results */
return task ? 0 : -1; return task ? 0 : -1;
@ -240,7 +236,6 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec, int
for (task = &tasklist; *task; task = &((*task)->next)) for (task = &tasklist; *task; task = &((*task)->next))
if (((*task)->tasktype & TASK_CLASS_MASK ) == TASK_DONE) { if (((*task)->tasktype & TASK_CLASS_MASK ) == TASK_DONE) {
struct ot_task *ptask = *task; struct ot_task *ptask = *task;
fprintf(stderr, "Got task %lu type %d with %d entries\n", (*task)->taskid, (*task)->tasktype, ptask->iovec_entries);
*iovec_entries = ptask->iovec_entries; *iovec_entries = ptask->iovec_entries;
*iovec = ptask->iovec; *iovec = ptask->iovec;
sock = ptask->sock; sock = ptask->sock;

Loading…
Cancel
Save