Skip to content

Can't convert Cache Result to Cache MISS by TSHttpTxnCacheLookupStatusSet #1764

Description

@scw00

I've tried to convert Cache Hit to Cache MISS by using TSHttpTxnCacheLookupStatusSet function and it always abort.

int
cache_read(TSCont contp, TSEvent event, void *edata)
{
	TSHttpTxn txnp = (TSHttpTxn)edata;
	TSHttpTxnCacheLookupStatusSet(txnp, TS_CACHE_LOOKUP_MISS);
	TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
}

void
TSPluginInit(int argc, const char *argv[])
{
	TSPluginRegistrationInfo info;

  info.plugin_name   = PLUGIN_NAME;
  info.vendor_name   = "Apache Software Foundation";
  info.support_email = "dev@trafficserver.apache.org";

  if (TSPluginRegister(&info) != TS_SUCCESS) {
    TSError("[%s] Plugin registration failed.", PLUGIN_NAME);
    goto error;
  }

  TSHttpHookAdd(TS_HTTP_READ_CACHE_HDR_HOOK, TSContCreate(cache_read, TSMutexCreate()));
  goto done;

error:
  TSError("[%s] Plugin not initialized", PLUGIN_NAME);

done:
  return;
}
#0  0x00007ffff2be2c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
        resultvar = 0
        pid = 8707
        selftid = 8710
#1  0x00007ffff2be6168 in __GI_abort () at abort.c:118
        act = {__sigaction_handler = {sa_handler = 0x0, sa_sigaction = 0x0}, sa_mask = {__val = {
              18446744073709551615 <repeats 16 times>}}, sa_flags = 0, sa_restorer = 0x0}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x00007ffff4bd60c5 in ink_abort (message_format=0x7ffff4c1b240 "%s:%d: failed assertion `%s`") at ink_error.cc:99
        ap = {{gp_offset = 32, fp_offset = 48, overflow_arg_area = 0x7ffff1e8b030, reg_save_area = 0x7ffff1e8af70}}
#3  0x00007ffff4bd072b in _ink_assert (expression=0xb76b60 "s->cache_lookup_result != HttpTransact::CACHE_LOOKUP_MISS", 
    file=0xb71600 "HttpTransact.cc", line=2395) at ink_assert.cc:37
No locals.
#4  0x0000000000743fee in HttpTransact::HandleCacheOpenReadHitFreshness (s=0x7fffedfeda48) at HttpTransact.cc:2395
        obj = @0x7fffedfedaa0: 0x60b00001ed98
        __FUNCTION__ = "HandleCacheOpenReadHitFreshness"
#5  0x00000000007080ef in HttpSM::call_transact_and_set_next_state (this=0x7fffedfed9d0, f=0x0) at HttpSM.cc:7215
        __FUNCTION__ = "call_transact_and_set_next_state"
#6  0x00000000006d4f4b in HttpSM::handle_api_return (this=0x7fffedfed9d0) at HttpSM.cc:1612
        __FUNCTION__ = "handle_api_return"
#7  0x00000000006d4a0f in HttpSM::state_api_callout (this=0x7fffedfed9d0, event=60000, data=0x0) at HttpSM.cc:1550
        api_next = HttpSM::API_RETURN_CONTINUE
        __FUNCTION__ = "state_api_callout"
#8  0x00000000006d2f4f in HttpSM::state_api_callback (this=0x7fffedfed9d0, event=60000, data=0x0) at HttpSM.cc:1346
        __FUNCTION__ = "state_api_callback"
#9  0x000000000057b8b1 in TSHttpTxnReenable (txnp=0x7fffedfed9d0, event=TS_EVENT_HTTP_CONTINUE) at InkAPI.cc:5891
        trylock = {m = {m_ptr = 0x608600004cd0}, lock_acquired = true}
        sm = 0x7fffedfed9d0
        eth = 0x7ffff1e90800
        __FUNCTION__ = "TSHttpTxnReenable"
#10 0x00007ffff0b76952 in cache_read (contp=0x608600014f70, event=TS_EVENT_HTTP_READ_CACHE_HDR, edata=0x7fffedfed9d0)
    at cache_read.cc:15
        txnp = 0x7fffedfed9d0
#11 0x0000000000566a54 in INKContInternal::handle_event (this=0x608600014f70, event=60005, edata=0x7fffedfed9d0)
    at InkAPI.cc:1055
        retval = 0
---Type <return> to continue, or q <return> to quit---
        __FUNCTION__ = "handle_event"
#12 0x0000000000539d2e in Continuation::handleEvent (this=0x608600014f70, event=60005, data=0x7fffedfed9d0)
    at /root/test/ats-self/iocore/eventsystem/I_Continuation.h:153
No locals.
#13 0x0000000000567b58 in APIHook::invoke (this=0x607200001fe0, event=60005, edata=0x7fffedfed9d0) at InkAPI.cc:1274
No locals.
#14 0x00000000006d424a in HttpSM::state_api_callout (this=0x7fffedfed9d0, event=0, data=0x0) at HttpSM.cc:1468
        plugin_lock = true
        plugin_mutex = {m_ptr = 0x608600002810}
        hook = 0x607200001fe0
        api_next = HttpSM::API_RETURN_UNKNOWN
        __FUNCTION__ = "state_api_callout"
#15 0x00000000006f6c76 in HttpSM::do_api_callout_internal (this=0x7fffedfed9d0) at HttpSM.cc:5190
No locals.
#16 0x00000000007195ed in HttpSM::do_api_callout (this=0x7fffedfed9d0) at HttpSM.cc:427
No locals.
#17 0x0000000000708532 in HttpSM::set_next_state (this=0x7fffedfed9d0) at HttpSM.cc:7256
        __FUNCTION__ = "set_next_state"
#18 0x00000000007083ed in HttpSM::call_transact_and_set_next_state (this=0x7fffedfed9d0, f=0x0) at HttpSM.cc:7223
        __FUNCTION__ = "call_transact_and_set_next_state"
#19 0x00000000006d4f4b in HttpSM::handle_api_return (this=0x7fffedfed9d0) at HttpSM.cc:1612
        __FUNCTION__ = "handle_api_return"
#20 0x00000000006d4a0f in HttpSM::state_api_callout (this=0x7fffedfed9d0, event=60000, data=0x0) at HttpSM.cc:1550
        api_next = HttpSM::API_RETURN_CONTINUE
        __FUNCTION__ = "state_api_callout"
#21 0x00000000006d2f4f in HttpSM::state_api_callback (this=0x7fffedfed9d0, event=60000, data=0x0) at HttpSM.cc:1346
        __FUNCTION__ = "state_api_callback"
#22 0x000000000057b8b1 in TSHttpTxnReenable (txnp=0x7fffedfed9d0, event=TS_EVENT_HTTP_CONTINUE) at InkAPI.cc:5891
        trylock = {m = {m_ptr = 0x608600004cd0}, lock_acquired = true}
        sm = 0x7fffedfed9d0
        eth = 0x7ffff1e90800
        __FUNCTION__ = "TSHttpTxnReenable"
#23 0x00007ffff0b76952 in cache_read (contp=0x608600014f70, event=TS_EVENT_HTTP_READ_CACHE_HDR, edata=0x7fffedfed9d0)
    at cache_read.cc:15
        txnp = 0x7fffedfed9d0
#24 0x0000000000566a54 in INKContInternal::handle_event (this=0x608600014f70, event=60005, edata=0x7fffedfed9d0)
---Type <return> to continue, or q <return> to quit---
    at InkAPI.cc:1055
        retval = 0
        __FUNCTION__ = "handle_event"
#25 0x0000000000539d2e in Continuation::handleEvent (this=0x608600014f70, event=60005, data=0x7fffedfed9d0)
    at /root/test/ats-self/iocore/eventsystem/I_Continuation.h:153
No locals.
#26 0x0000000000567b58 in APIHook::invoke (this=0x607200001fe0, event=60005, edata=0x7fffedfed9d0) at InkAPI.cc:1274
No locals.
#27 0x00000000006d424a in HttpSM::state_api_callout (this=0x7fffedfed9d0, event=0, data=0x0) at HttpSM.cc:1468
        plugin_lock = true
        plugin_mutex = {m_ptr = 0x608600002810}
        hook = 0x607200001fe0
        api_next = HttpSM::API_RETURN_UNKNOWN
        __FUNCTION__ = "state_api_callout"
#28 0x00000000006f6c76 in HttpSM::do_api_callout_internal (this=0x7fffedfed9d0) at HttpSM.cc:5190
No locals.
#29 0x00000000007195ed in HttpSM::do_api_callout (this=0x7fffedfed9d0) at HttpSM.cc:427
No locals.
#30 0x0000000000708532 in HttpSM::set_next_state (this=0x7fffedfed9d0) at HttpSM.cc:7256
        __FUNCTION__ = "set_next_state"
#31 0x00000000007083ed in HttpSM::call_transact_and_set_next_state (this=0x7fffedfed9d0, 
    f=0x7408f8 <HttpTransact::HandleCacheOpenRead(HttpTransact::State*)>) at HttpSM.cc:7223
        __FUNCTION__ = "call_transact_and_set_next_state"
#32 0x00000000006ddd35 in HttpSM::state_cache_open_read (this=0x7fffedfed9d0, event=1102, data=0x60b00001ec40) at HttpSM.cc:2609
        __FUNCTION__ = "state_cache_open_read"
#33 0x00000000006de986 in HttpSM::main_handler (this=0x7fffedfed9d0, event=1102, data=0x60b00001ec40) at HttpSM.cc:2671
        jump_point = NULL
        __FUNCTION__ = "main_handler"
        vc_entry = 0x0
#34 0x0000000000539d2e in Continuation::handleEvent (this=0x7fffedfed9d0, event=1102, data=0x60b00001ec40)
    at /root/test/ats-self/iocore/eventsystem/I_Continuation.h:153
No locals.
#35 0x00000000006ab2b2 in HttpCacheSM::state_cache_open_read (this=0x7fffedfef2f0, event=1102, data=0x60b00001ec40)
    at HttpCacheSM.cc:132
        __FUNCTION__ = "state_cache_open_read"
#36 0x0000000000539d2e in Continuation::handleEvent (this=0x7fffedfef2f0, event=1102, data=0x60b00001ec40)
---Type <return> to continue, or q <return> to quit---
    at /root/test/ats-self/iocore/eventsystem/I_Continuation.h:153
No locals.
#37 0x00000000009e98eb in CacheVC::callcont (this=0x60b00001ec40, event=1102) at P_CacheInternal.h:633
No locals.
#38 0x00000000009e872b in CacheVC::openReadStartHead (this=0x60b00001ec40, event=3900, e=0x0) at CacheRead.cc:1131
        err = 20400
        doc = 0x7fffeded6000
        __FUNCTION__ = "openReadStartHead"
#39 0x0000000000539d2e in Continuation::handleEvent (this=0x60b00001ec40, event=3900, data=0x0)
    at /root/test/ats-self/iocore/eventsystem/I_Continuation.h:153
No locals.
#40 0x0000000000997d0c in CacheVC::handleReadDone (this=0x60b00001ec40, event=3900, e=0x60b00001edc8) at Cache.cc:2438
        doc = 0x7fffeded6000
        __FUNCTION__ = "handleReadDone"
#41 0x0000000000539d2e in Continuation::handleEvent (this=0x60b00001ec40, event=3900, data=0x60b00001edc8)
    at /root/test/ats-self/iocore/eventsystem/I_Continuation.h:153
No locals.
#42 0x00000000009a3a95 in AIOCallbackInternal::io_complete (this=0x60b00001edc8, event=1, data=0x608e00006ee0)
    at /root/test/ats-self/iocore/aio/P_AIO.h:117
No locals.
#43 0x0000000000539d2e in Continuation::handleEvent (this=0x60b00001edc8, event=1, data=0x608e00006ee0)
    at /root/test/ats-self/iocore/eventsystem/I_Continuation.h:153
No locals.
#44 0x0000000000ac0b2b in EThread::process_event (this=0x7ffff1e90800, e=0x608e00006ee0, calling_code=1) at UnixEThread.cc:143
        c_temp = 0x60b00001edc8
        lock = {m = {m_ptr = 0x608600004cd0}, lock_acquired = true}
        __FUNCTION__ = "process_event"
#45 0x0000000000ac1022 in EThread::execute (this=0x7ffff1e90800) at UnixEThread.cc:197
        done_one = false
        e = 0x608e00006ee0
        NegativeQueue = {<DLL<Event, Event::Link_link>> = {head = 0x608e00006d60}, tail = 0x608e00006b80}
        next_time = 1493965798352082959
        __FUNCTION__ = "execute"
#46 0x0000000000abf478 in spawn_thread_internal (a=0x600800016250) at Thread.cc:84
        p = 0x600800016250
#47 0x00007ffff4e63b98 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.0
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#48 0x00007ffff39a0184 in start_thread (arg=0x7ffff1e8d700) at pthread_create.c:312
        __res = <optimized out>
        pd = 0x7ffff1e8d700
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737251956480, -5697319536598316563, 1, 8, 11268912, 140737251956480, 
                5697314940414200301, 5697309874613914093}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {
              prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#49 0x00007ffff2ca9bed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions