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

Crash when selecting virtual columns generated using JSON functions



    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2.6, 10.2.7
    • Fix Version/s: 10.2.8
    • Component/s: JSON, Virtual Columns
    • Labels:
    • Environment:


      I have discovered an issue which causes the server to crash and restart, when it is trying to calculate (or after it has calculated) a virtual column. I have been able to reliably reproduce this with the table structure below, if I insert a record, update a record (regardless of if the update affects the field the virtual column is calculated on or not) or delete a record, then the next time I do a select that includes one of the virtual columns (including select *), MariaDB will crash. The reason I am listing this with the summary saying "non-cached" and I earlier said that it crashes after calculating the virtual column is that once the server has restarted, if you rerun the select, it works fine - with the correct calculated column.

      The table in question is called 'supplierSendingTimes'. There are two virtual columns, looking at a JSON string to select from it two times (a start time and an end time) - with the column definitions varying only in that they select the key "start" or "end". The column definition is (the full table def is in bugReportDump.sql:

      `currentStartTime` time GENERATED ALWAYS AS (coalesce(cast(json_value(json_extract(`jsonRuleString`,concat('$.singleDates."',curdate(),'"')),'$.start') as time),cast(json_value(json_extract(`jsonRuleString`,concat('$.singleDay."',dayname(curdate()),'"')),'$.start') as time),cast(json_value(json_extract(`jsonRuleString`,'$.default'),'$.start') as time))) VIRTUAL,

      The stack trace appears to be different, depending on if you are inserting or updating; and if updating, if you are doing a select * or select <columns>. I haven't check the error logs, but it might also be different on delete, if it would be useful for me to check, please let me know.

      Hopefully this is enough information, but if I can provide further information, please let me know.




            serg Sergei Golubchik
            rmhumphries Robert Humphries
            0 Vote for this issue
            4 Start watching this issue