Hi,

I am trying a new algorithm for load balancing with balancer plugin.
I am computing the time taken for one byte transfer by a  server and based on 
that I am deciding.
Before that I just used the delay as it is without concerning the file size and 
was working fine.
Now thought of considering time taken for one byte transfer and now the traffic 
server crashes  few times but most of the time  it is working.
I am not sure whether my code is causing the problem.

snippet of my code:

case TS_EVENT_HTTP_TXN_CLOSE:
          {
            url = TSHttpTxnEffectiveUrlStringGet(txn, &len);



            TSHttpTxnMilestoneGet(txn, TS_MILESTONE_UA_BEGIN, &start_time);
            TSHttpTxnMilestoneGet(txn, TS_MILESTONE_SERVER_CLOSE, &end_time);

            interval_time = end_time - start_time;
            if (TS_SUCCESS == TSHttpTxnServerRespGet(txn, &hdr_bufp, &hdr_loc)) 
{                     //This block of code was taken from 
plugins/background_fetch/rules.cc<http://rules.cc>
                TSMLoc loc = TSMimeHdrFieldFind(hdr_bufp, hdr_loc, 
"Content-Length", -1);

                 if (TS_NULL_MLOC != loc) {
                    content_len = TSMimeHdrFieldValueUintGet(hdr_bufp, hdr_loc, 
loc, 0 );
                  }
               TSHandleMLocRelease(hdr_bufp, hdr_loc, loc);
          }
           if(content_len != 0){
               byte_time = interval_time/content_len ;
               }

I tried to read the content length from TS_EVENT_HTTP_READ_RESPONSE_HDR and I 
was afraid that there might be synchronization problem with threads in using 
“content_len” variable.
Any pointers on how to solve this issue is appreciated.

Please find attached the traffic.out file which contains the crash information.

Thanks
Gandhimathi

Reply via email to