Re: prob with head

From: Andres Kroonmaa <andre@dont-contact.us>
Date: Sat, 19 Oct 2002 02:26:03 +0300

On 18 Oct 2002, at 21:06, Andres Kroonmaa <andre@online.ee> wrote:

> both http->conn->auth_user_request and http->request are 0x0 below.
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x806b9b6 in clientAccessCheckDone (answer=1, data=0x85417e8) at client_side_request.c:226
> 226 proxy_auth_msg = authenticateAuthUserRequestMessage((http->conn
> (gdb) bt
> #0 0x806b9b6 in clientAccessCheckDone (answer=1, data=0x85417e8) at client_side_request.c:226
> #1 0x80505ee in aclCheckCallback (checklist=0x8503270, answer=ACCESS_ALLOWED) at acl.c:1874
> #2 0x80503eb in aclCheck (checklist=0x8503270) at acl.c:1831
> #3 0x8050631 in aclLookupDstIPDone (ia=0x8326820, data=0x8503270) at acl.c:1906
> #4 0x809a47d in ipcacheCallback (i=0x8326810) at ipcache.c:227
> #5 0x809a96b in ipcacheHandleReply (data=0x8506cb0, answers=0x8666100, na=9) at ipcache.c:385
> #6 0x80767f4 in idnsGrokReply (buf=0x8139c60 "\001\205\201\200", sz=310) at dns_internal.c:485
> #7 0x8076ad5 in idnsRead (fd=6, data=0x0) at dns_internal.c:557
> #8 0x8070063 in comm_check_incoming_poll_handlers (nfds=1, fds=0x80373f8) at comm_poll.c:245
> #9 0x80710d9 in comm_poll_dns_incoming () at comm_poll.c:553
> #10 0x8070ede in comm_select (msec=2) at comm_poll.c:513
> #11 0x809d6e5 in main (argc=2, argv=0x80478e8) at main.c:717

 I'm unable to find the cause, but after digging abit I'm getting opinion
 that its to do with counted referencing issues.
 The request that triggered the crash is pretty normal http request, passed
 through dstip acl checks and dns lookups. Nothing special.
 http->request is source for setting context->acl_checklist->request, but
 at crash time http->request is junked, while its copy in context->checklist
 is ok. Seems like client is aborting before dns lookup finishes.

215 clientAccessCheckDone(int answer, void *data)
216 {
217 clientRequestContext *context = data;
218 clientHttpRequest *http = context->http;
219 err_type page_id;
220 http_status status;
221 char *proxy_auth_msg = NULL;
222 debug(85, 2) ("The request %s %s is %s, because it matched '%s'\n",
223 RequestMethodStr[http->request->method], http->uri,
224 answer == ACCESS_ALLOWED ? "ALLOWED" : "DENIED",
225 AclMatchedName ? AclMatchedName : "NO ACL's");
226 proxy_auth_msg = authenticateAuthUserRequestMessage((http->conn
227 && http->conn->auth_user_request) ? http->conn->
228 auth_user_request : http->request->auth_user_request);
229 context->acl_checklist = NULL;

 Dunno how to fix this. http->request is filled by requestLink() which
 makes simple pointer copy, and destroyed with memfree, thus it isn't
 refcounted and using it after timeconsuming aclchecks doesn't seem safe.

(gdb) p context->acl_checklist->request
$83 = (request_t *) 0x84d8d48
(gdb) p context->http->request
$84 = (request_t *) 0x0

(gdb) p *context
$79 = {acl_checklist = 0x84f9b70, redirect_state = 0, http = 0x8533aac}
(gdb) p *context->http
$80 = {conn = 0x852a374, request = 0x0, uri = 0x0, log_uri = 0x0, out = {offset = 0, size = 0, headers_sz = 0},
  range_iter = {pos = 0, spec = 0x0, debt_size = 0, prefix_size = 0, boundary = {size = 0, len = 0, buf = 0x0}},
  req_sz = 93, entry = 0x0, old_entry = 0x0, logType = LOG_TAG_NONE, start = {tv_sec = 1034970082, tv_usec = 169284},
  http_ver = {major = 1, minor = 0}, al = {url = 0x0, http = {method = METHOD_NONE, code = 0, content_type = 0x0,
      version = {major = 0, minor = 0}}, icp = {opcode = ICP_INVALID}, cache = {caddr = {S_un = {S_un_b = {
            s_b1 = 0 '\000', s_b2 = 0 '\000', s_b3 = 0 '\000', s_b4 = 0 '\000'}, S_un_w = {s_w1 = 0, s_w2 = 0},
          S_addr = 0}}, size = 0, code = LOG_TAG_NONE, msec = 0, rfc931 = 0x0, authuser = 0x0}, headers = {
      request = 0x0, reply = 0x0}, _private = {method_str = 0x0}, hier = {code = HIER_NONE,
      host = '\000' <repeats 255 times>, ping = {start = {tv_sec = 0, tv_usec = 0}, stop = {tv_sec = 0, tv_usec = 0},
        n_sent = 0, n_recv = 0, n_replies_expected = 0, timeout = 0, timedout = 0, w_rtt = 0, p_rtt = 0},
      cd_host = '\000' <repeats 255 times>, alg = PEER_SA_NONE, cd_lookup = LOOKUP_NONE, n_choices = 0,
      n_ichoices = 0, peer_select_start = {tv_sec = 0, tv_usec = 0}, store_complete_stop = {tv_sec = 0,
        tv_usec = 0}}}, flags = {accel = 0, internal = 0, done_copying = 0, purging = 0}, redirect = {
    status = HTTP_STATUS_NONE, location = 0x0}, active = {data = 0x8533aac, prev = 0x0, next = 0x0}, client_stream = {
    head = 0x853a310, tail = 0x853a310}}

(gdb) p *context->acl_checklist
$81 = {accessList = 0x0, src_addr = {S_un = {S_un_b = {s_b1 = 213 'Õ', s_b2 = 180 '´', s_b3 = 18 '\022',
        s_b4 = 114 'r'}, S_un_w = {s_w1 = 46293, s_w2 = 29202}, S_addr = 1913828565}}, dst_addr = {S_un = {S_un_b = {
        s_b1 = 0 '\000', s_b2 = 0 '\000', s_b3 = 0 '\000', s_b4 = 0 '\000'}, S_un_w = {s_w1 = 0, s_w2 = 0},
      S_addr = 0}}, my_addr = {S_un = {S_un_b = {s_b1 = 194 'Â', s_b2 = 106 'j', s_b3 = 96 '`', s_b4 = 89 'Y'},
      S_un_w = {s_w1 = 27330, s_w2 = 22880}, S_addr = 1499491010}}, my_port = 80, request = 0x84d8d48, reply = 0x0,
  conn = 0x852a374, rfc931 = '\000' <repeats 63 times>, auth_user_request = 0x0, state = {ACL_LOOKUP_NONE,
    ACL_LOOKUP_NONE, ACL_LOOKUP_DONE, ACL_LOOKUP_NONE <repeats 24 times>}, snmp_community = 0x0, callback = 0,
  callback_data = 0x0, extacl_entry = 0x0}

(gdb) p *context->acl_checklist->request
$82 = {method = METHOD_GET, protocol = PROTO_HTTP, login = '\000' <repeats 127 times>,
  host = "ping.180solutions.com", '\000' <repeats 235 times>, auth_user_request = 0x0, port = 80, urlpath = {
    size = 36, len = 1, buf = 0x82d8414 "/"}, canonical = 0x8532b68 "http://ping.180solutions.com/", link_count = 1,
  flags = {range = 0, nocache = 0, ims = 0, auth = 0, cachable = 0, hierarchical = 0, loopdetect = 0,
    proxy_keepalive = 0, proxying = 0, refresh = 0, redirected = 0, need_validation = 0, accelerated = 0,
    internal = 0, internalclient = 0, body_sent = 0, reset_tcp = 0}, cache_control = 0x0, range = 0x0, http_ver = {
    major = 1, minor = 0}, ims = 0, imslen = 0, max_forwards = -1, client_addr = {S_un = {S_un_b = {s_b1 = 213 'Õ',
        s_b2 = 180 '´', s_b3 = 18 '\022', s_b4 = 114 'r'}, S_un_w = {s_w1 = 46293, s_w2 = 29202},
      S_addr = 1913828565}}, my_addr = {S_un = {S_un_b = {s_b1 = 194 'Â', s_b2 = 106 'j', s_b3 = 96 '`',
        s_b4 = 89 'Y'}, S_un_w = {s_w1 = 27330, s_w2 = 22880}, S_addr = 1499491010}}, my_port = 80, header = {
    entries = {capacity = 16, count = 2, items = 0x8585830}, mask = "\000\000\200\000\002\000\000", owner = hoRequest,
    len = 47}, body_connection = 0x0, content_length = -1, hier = {code = HIER_NONE,
    host = '\000' <repeats 255 times>, ping = {start = {tv_sec = 0, tv_usec = 0}, stop = {tv_sec = 0, tv_usec = 0},
      n_sent = 0, n_recv = 0, n_replies_expected = 0, timeout = 0, timedout = 0, w_rtt = 0, p_rtt = 0},
    cd_host = '\000' <repeats 255 times>, alg = PEER_SA_NONE, cd_lookup = LOOKUP_NONE, n_choices = 0, n_ichoices = 0,
    peer_select_start = {tv_sec = 0, tv_usec = 0}, store_complete_stop = {tv_sec = 0, tv_usec = 0}},
  errType = ERR_NONE, peer_login = 0x0, lastmod = -1, vary_headers = 0x0}

------------------------------------
 Andres Kroonmaa <andre@online.ee>
 CTO, Microlink Online
 Tel: 6501 731, Fax: 6501 725
 Pärnu mnt. 158, Tallinn,
 11317 Estonia
Received on Fri Oct 18 2002 - 17:35:45 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:16:57 MST