Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13286

Floating point exception in Filesort_tracker::print_json_members(Json_writer*)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2.7
    • Fix Version/s: 10.2.8
    • Component/s: Optimizer
    • Labels:
      None
    • Environment:
      bb-10.2-compatibility/build-14921

      Description

      Crasch happens on "ANALYZE FORMAT=JSON ..." on a specific query involving views

      170710 19:49:05 [ERROR] mysqld got signal 8 ;
      [...]
      /usr/sbin/mysqld(Filesort_tracker::print_json_members(Json_writer*)+0xbc)[0x7f85b97ec15c]
      /usr/sbin/mysqld(Explain_aggr_filesort::print_json_members(Json_writer*, bool)+0x174)[0x7f85b97e6884]
      /usr/sbin/mysqld(Explain_aggr_window_funcs::print_json_members(Json_writer*, bool)+0x65)[0x7f85b97e6935]
      /usr/sbin/mysqld(Explain_select::print_explain_json(Explain_query*, Json_writer*, bool)+0x223)[0x7f85b97eb443]
      /usr/sbin/mysqld(Explain_table_access::print_explain_json(Explain_query*, Json_writer*, bool)+0x760)[0x7f85b97eab90]
      /usr/sbin/mysqld(Explain_basic_join::print_explain_json_interns(Explain_query*, Json_writer*, bool)+0x3f)[0x7f85b97eb18f]
      /usr/sbin/mysqld(Explain_select::print_explain_json(Explain_query*, Json_writer*, bool)+0x397)[0x7f85b97eb5b7]
      /usr/sbin/mysqld(Explain_query::print_explain_json(select_result_sink*, bool)+0x2b2)[0x7f85b97e53f2]
      /usr/sbin/mysqld(Explain_query::send_explain(THD*)+0xa8)[0x7f85b97e5528]
      

      The actual crash is probably due at

      33     writer->add_member("r_total_time_ms").
       34             add_double(time_tracker.get_time_ms());
      

      in inlined member function get_time_ms():

       75   double get_time_ms() const
       76   {
       77     // convert 'cycles' to milliseconds.
       78     return 1000 * ((double)cycles) / sys_timer_info.cycles.frequency;
       79   }
      

      Or at least that's the only floating point operation in print_json_members() that I can identify.

      A quick naive check shows that there may indeed situations where "frequency" is zero and so may cause a division by zero exception:

      $ sourcefind -n "cycles.frequency= 0"
      ./mysys/my_rdtsc.c:580:    mti->cycles.frequency= 0;
      

        Attachments

          Activity

            People

            Assignee:
            varun Varun Gupta
            Reporter:
            hholzgra Hartmut Holzgraefe
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: