Skip to content

Crash while using next hop strategy #8329

Closed

Description

@meeramn

Strategies yaml config got loaded but seeing crash after sending curl request. I tested with 9.0.x and 9.1.x branches and crashed on both. I tried multiple "hash_key:path" and "hash_key:hostname" in yaml.

Please find the configuration and logs below.

cat remap.config

map /nexthop-test/ http://httpbin.org/ @strategy=nexthop-test-strategy

cat strategies.yaml

hosts:
  - &nexthop-test-host
    host: test-host.xyz.com
    protocol:
      - scheme: http
        port: 80
      - scheme: https
        port: 443

groups:
  - &nexthop-test-group
    - <<: *nexthop-test-host
      weight: 1.5

strategies:
  - strategy: 'nexthop-test-strategy'
    policy: consistent_hash
    hash_key: path
    go_direct: false
    groups:
      - *nexthop-test-group
    scheme: http
    failover:
      ring_mode: alternate_ring
      response_codes:
        - 404
      markdown_codes:
        - 503
      health_check:
        - passive

Curl

curl -vvv -o /dev/null http://localhost/nexthop-test/get
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* About to connect() to localhost port 80 (#0)
*   Trying ::1...
* Connected to localhost (::1) port 80 (#0)
> GET /nexthop-test/get HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost
> Accept: */*
>
  0     0    0     0    0     0      0      0 --:--:--  0:00:34 --:--:--     0* Empty reply from server
  0     0    0     0    0     0      0      0 --:--:--  0:00:34 --:--:--     0
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server

Stack trace

traffic_server: received signal 11 (Segmentation fault)
traffic_server - STACK TRACE:
/opt/ats/bin/traffic_server(crash_logger_invoke(int, siginfo_t*, void*)+0x94)[0x55edd0cc3524]
/lib64/libpthread.so.0(+0xf630)[0x7f8c4352f630]
/opt/ats/lib/trafficserver/libtscore.so.9(ATSConsistentHash::lookup(char const*, std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::__value_type<unsigned long, ATSConsistentHashNode*>, std::__1::__tree_node<std::__1::__value_type<unsigned long, ATSConsistentHashNode*>, void*>*, long> >*, bool*, ATSHash64*)+0xf3)[0x7f8c44a177d3]
/opt/ats/bin/traffic_server(NextHopConsistentHash::findNextHop(tsapi_httptxn*, void*, long)+0x87f)[0x55edd0dc7e3f]
/opt/ats/bin/traffic_server(+0x254617)[0x55edd0d93617]
/opt/ats/bin/traffic_server(+0x2387be)[0x55edd0d777be]
/opt/ats/bin/traffic_server(HttpTransact::handle_response_from_parent(HttpTransact::State*)+0xbaa)[0x55edd0d85f0a]
/opt/ats/bin/traffic_server(HttpTransact::HandleResponse(HttpTransact::State*)+0x4a5)[0x55edd0d7adc5]
/opt/ats/bin/traffic_server(HttpSM::handle_server_setup_error(int, void*)+0x3a1)[0x55edd0d52491]
/opt/ats/bin/traffic_server(HttpSM::state_read_server_response_header(int, void*)+0x540)[0x55edd0d51e90]
/opt/ats/bin/traffic_server(HttpSM::main_handler(int, void*)+0x1ac)[0x55edd0d4099c]
/opt/ats/bin/traffic_server(+0x409883)[0x55edd0f48883]
/opt/ats/bin/traffic_server(UnixNetVConnection::net_read_io(NetHandler*, EThread*)+0xa94)[0x55edd0f47574]
/opt/ats/bin/traffic_server(NetHandler::process_ready_list()+0xa3)[0x55edd0f38793]
/opt/ats/bin/traffic_server(NetHandler::waitForActivity(long)+0x54e)[0x55edd0f38e6e]
/opt/ats/bin/traffic_server(non-virtual thunk to NetHandler::waitForActivity(long)+0xd)[0x55edd0f38f3d]
/opt/ats/bin/traffic_server(EThread::execute_regular()+0x55f)[0x55edd0f68dff]
/opt/ats/bin/traffic_server(EThread::execute()+0x179)[0x55edd0f69079]
/opt/ats/bin/traffic_server(+0x428556)[0x55edd0f67556]
/lib64/libpthread.so.0(+0x7ea5)[0x7f8c43527ea5]
/lib64/libc.so.6(clone+0x6d)[0x7f8c42d288dd]
Segmentation fault

Complete Logs

GDB

Activity

  1. self-assigned this
    on Sep 16, 2021
  2. jrushford commented on Sep 17, 2021

    @jrushford
    Contributor

    @meeramn I've tried your exact configuration and curl command on 9.1.x. I've tried the config and am unable to duplicate the crash. I've tried different failure scenarios with the parent, unreachable, trafficserver shutdown, etc and am not able to duplicate the crash. Everything is working as expected.

  3. jrushford commented on Sep 17, 2021

    @jrushford
    Contributor

    @meeramn I can re-create the crash when I'm running trafficserver on macOS. I cannot duplicate it on a linux build with devtoolset-9

  4. randall commented on Sep 20, 2021

    @randall
    Contributor

    We build with llvm 12, so maybe a difference in how gcc/llvm handles things.

    Full stack of crashed thread:

    #0  0x00007febf7b221d9 in waitpid () from /lib64/libpthread.so.0
    #1  0x00005639c1c44504 in crash_logger_invoke(int, siginfo_t*, void*) (signo=11, info=0x7febeff05b70, ctx=0x7febeff05a40)
        at traffic_server/Crash.cc:168
    #2  <signal handler called>
    #3  __tree_min<std::__tree_node_base<void *> *> (__x=0x600) at /opt/ats/include/c++/v1/__tree:147
    #4  __tree_next_iter<std::__tree_end_node<std::__tree_node_base<void *> *> *, std::__tree_node_base<void *> *> (
        __x=0x7febf5789fb0) at /opt/ats/include/c++/v1/__tree:183
    #5  operator++ (this=<optimized out>) at /opt/ats/include/c++/v1/__tree:842
    #6  operator++ (this=<optimized out>) at /opt/ats/include/c++/v1/map:804
    #7  operator++ (this=<optimized out>) at /opt/ats/include/c++/v1/map:809
    #8  ATSConsistentHash::lookup(char const*, std::__1::__map_iterator<std::__1::__tree_iterator<std::__1::__value_type<unsigned long, ATSConsistentHashNode*>, std::__1::__tree_node<std::__1::__value_type<unsigned long, ATSConsistentHashNode*>, void*>*, long> >*, bool*, ATSHash64*) (this=0x7febf5789f98, url=0x0, i=0x7feb4fd33f68, w=<optimized out>, h=<optimized out>)
        at ConsistentHash.cc:109
    #9  0x00005639c1d48e3f in chash_lookup (ring=..., hash_key=298391872744178962, iter=0x7feb4fd33f68, 
        wrapped=0x7febeff068bf, hash=0x7febeff068c0, hash_init=<optimized out>, mapWrapped=<optimized out>, 
        sm_id=<optimized out>) at NextHopConsistentHash.cc:48
    #10 NextHopConsistentHash::findNextHop(tsapi_httptxn*, void*, long) (this=0x7febf59ff018, txnp=0x7feb4fd33500, 
        ih=<optimized out>, now=0) at NextHopConsistentHash.cc:337
    #11 0x00005639c1d14617 in nextParent(HttpTransact::State*) (s=0x7feb4fd33600) at HttpTransact.cc:249
    #12 0x00005639c1cf87be in find_server_and_update_current_info(HttpTransact::State*) (s=0x7feb4fd33600)
        at HttpTransact.cc:584
    #13 0x00005639c1d06f0a in HttpTransact::handle_response_from_parent(HttpTransact::State*) (s=0x7feb4fd33600)
        at HttpTransact.cc:3665
    #14 0x00005639c1cfbdc5 in HttpTransact::HandleResponse(HttpTransact::State*) (s=0x7feb4fd33600) at HttpTransact.cc:3462
    #15 0x00005639c1cd3491 in call_transact_and_set_next_state (this=0x7feb4fd33500, f=<optimized out>) at HttpSM.cc:7391
    #16 HttpSM::handle_server_setup_error(int, void*) (this=0x7feb4fd33500, event=<optimized out>, data=<optimized out>)
        at HttpSM.cc:5790
    #17 0x00005639c1cd2e90 in HttpSM::state_read_server_response_header(int, void*) (this=0x7feb4fd33500, event=104, 
        data=0x7febe9742e60) at HttpSM.cc:2063
    #18 0x00005639c1cc199c in HttpSM::main_handler(int, void*) (this=0x7feb4fd33500, event=104, data=0x7febe9742e60)
        at HttpSM.cc:2715
    #19 0x00005639c1ec9883 in handleEvent (this=<optimized out>, event=104, data=0x7feb4fd33f68)
        at /usr/src/debug/ats-trafficserver-9.1.1/iocore/eventsystem/I_Continuation.h:219
    #20 read_signal_and_update(int, UnixNetVConnection*) (event=104, vc=0x7febe9742c80) at UnixNetVConnection.cc:83
    #21 0x00005639c1ec8574 in read_signal_done (event=104, nh=0x7febf5211d50, vc=0x7febe9742c80) at UnixNetVConnection.cc:150
    #22 read_from_net (nh=<optimized out>, vc=<optimized out>, thread=<optimized out>) at UnixNetVConnection.cc:292
    #23 UnixNetVConnection::net_read_io(NetHandler*, EThread*) (this=<optimized out>, nh=0x7febf5211d50, 
        lthread=<optimized out>) at UnixNetVConnection.cc:921
    #24 0x00005639c1eb9793 in NetHandler::process_ready_list() (this=0x7febf5211d50) at UnixNet.cc:415
    #25 0x00005639c1eb9e6e in NetHandler::waitForActivity(long) (this=<optimized out>, timeout=<optimized out>)
        at UnixNet.cc:552
    #26 0x00005639c1eb9f3d in non-virtual thunk to NetHandler::waitForActivity(long) ()
    #27 0x00005639c1ee9dff in EThread::execute_regular() (this=0x7febf520dbc0) at UnixEThread.cc:303
    #28 0x00005639c1eea079 in EThread::execute() (this=0x7febf520dbc0) at UnixEThread.cc:364
    #29 0x00005639c1ee8556 in spawn_thread_internal(void*) (a=0x7febf62519e0) at Thread.cc:92
    #30 0x00007febf7b1aea5 in start_thread () from /lib64/libpthread.so.0
    #31 0x00007febf731b8dd in clone () from /lib64/libc.so.6
    
  5. added 3 commits that reference this issue on Sep 29, 2021
  6. added 3 commits that reference this issue on Sep 29, 2021
  7. added a commit that references this issue on Oct 7, 2021
  8. added a commit that references this issue on Oct 7, 2021
  9. added a commit that references this issue on Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions