Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-5096

Lua metrics crashes if the prefix is missing

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.1.0
    • Component/s: Lua, Metrics
    • Labels:
      None

      Description

      Using the example from the tslua.so documentation:

      local test_stat;
      
      function __init__(args)
          test_stat = ts.stat_create("test_stat",
            TS_LUA_RECORDDATATYPE_INT,
            TS_LUA_STAT_PERSISTENT,
            TS_LUA_STAT_SYNC_COUNT)
      end
      

      traffic_manager crashes in metrics update:

      (gdb) where
      #0  0x00007ffff5c964ad in __cxa_throw () from /lib64/libstdc++.so.6
      #1  0x00007ffff5cbfdcf in std::__throw_length_error(char const*) () from /lib64/libstdc++.so.6
      #2  0x00007ffff5d2a7ec in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long) () from /lib64/libstdc++.so.6
      #3  0x00000000004bbcf4 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (this=0x7fffffffdc10, __beg=0x92ec30 "test_stat", __end=0x0) at /usr/include/c++/6.2.1/bits/basic_string.tcc:219
      #4  0x00007ffff5d2d515 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&) () from /lib64/libstdc++.so.6
      #5  0x00000000004bd228 in install_metrics_object (rec_type=RECT_PLUGIN, edata=0x7fffffffdcf0, registered=1,
          name=0x92ec30 "test_stat", data_type=1, datum=0x7ffff7f7dc48) at metrics.cc:214
      #6  0x00000000004a51a1 in RecDumpRecords (rec_type=46,
          callback=0x4bd1a3 <install_metrics_object(RecT, void*, int, char const*, int, RecData*)>, edata=0x7fffffffdcf0)
          at RecCore.cc:1020
      #7  0x00000000004bd2dd in lua_metrics_install (L=0x40000378) at metrics.cc:229
      #8  0x0000000000449209 in update_metrics_namespace (L=0x40000378) at metrics.cc:167
      #9  0x0000000000449944 in metrics_binding_evaluate (binding=...) at metrics.cc:377
      #10 0x000000000044844d in main (argc=1, argv=0x7fffffffe578) at traffic_manager.cc:772
      (gdb)
      #5  0x00000000004bd228 in install_metrics_object (rec_type=RECT_PLUGIN, edata=0x7fffffffdcf0, registered=1,
          name=0x92ec30 "test_stat", data_type=1, datum=0x7ffff7f7dc48) at metrics.cc:214
      214	    prefixes->insert(std::string(name, len));
      (gdb) p len
      $1 = -9628720
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jamespeach James Peach
                Reporter:
                jamespeach James Peach
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m