Skip to content

mysqltest on Windows crashes (core dump) when executing custom function auto_inc.nextval_func #552

@chyujing

Description

@chyujing

Environment

  • Version: Server version: 5.7.25 OceanBase seekdb (r) (Built 1-e1ac5a57bf17078ca46ec9add574edeffac7c3f9 Apr 7 2026)
  • Platform: Windows
  • Is this a temporary version provided by RD?: No
  • Reproducibility: Stable reproduction

Description

When running the mysqltest case auto_inc.nextval_func on Windows, the server crashes (core dump) upon executing a custom function (NEXTVAL). The crash occurs in a background thread, causing the process to terminate.

Steps to Reproduce

  1. Connection String: mysql -uroot -h -P 2881
  2. Case Name: auto_inc.nextval_func
  3. Direct Reproduction Steps: Execute the following SQL sequence:
DROP TABLE IF EXISTS tfm_sequences;

CREATE TABLE tfm_sequences (
  sequence_name varchar(80) DEFAULT NULL,
  increment_by int(11) DEFAULT NULL,
  current_value bigint(20) DEFAULT NULL,
  min_value bigint(20) DEFAULT NULL,
  max_value bigint(20) DEFAULT NULL,
  comments varchar(200) DEFAULT NULL,
  cycle varchar(10) DEFAULT NULL
);
DELIMITER //
CREATE FUNCTION NEXTVAL(a_seq_name VARCHAR(55)) RETURNS bigint(20)
BEGIN
    DECLARE seq_val BIGINT;
    DECLARE min_val BIGINT;
    DECLARE max_val BIGINT;
    DECLARE cycle_val VARCHAR(10);
    DECLARE exist int;
    SET seq_val = -1;
    set exist=0;
    SELECT COUNT(1) INTO exist FROM TFM_SEQUENCES holdlock WHERE SEQUENCE_NAME = a_seq_name;
    IF exist = 1
    THEN
      SELECT
        CURRENT_VALUE + INCREMENT_BY,
        MIN_VALUE,
        MAX_VALUE,
        CYCLE
      INTO seq_val, min_val, max_val, cycle_val
      FROM TFM_SEQUENCES
      WHERE SEQUENCE_NAME = a_seq_name FOR UPDATE;
      IF seq_val > max_val
      THEN
        IF cycle_val = 'CYCLE'
        THEN
          SET seq_val = min_val;
        # ELSE
        #   SIGNAL SQLSTATE '42000';
        #   SET MESSAGE_TEXT ='error:1000,sequence beyond the max value ';
        END IF;
      END IF;
      UPDATE TFM_SEQUENCES
      SET CURRENT_VALUE = seq_val
      WHERE SEQUENCE_NAME = a_seq_name;
    # ELSE
    #   SIGNAL SQLSTATE '42000';
    #   SET MESSAGE_TEXT ='error:1001,Query was empty,sequence name not found ';
    END IF;
    RETURN seq_val;
  END //

DELIMITER ;
INSERT INTO TFM_SEQUENCES VALUES ("ABC", 1,1,1,10000, "Sequence name as ABC",0);
INSERT INTO TFM_SEQUENCES VALUES ("mySeq", 1,1,1,10000, "Sequence name as mySeq",0);
SELECT NEXTVAL("ABC") FROM TFM_SEQUENCES;
  1. Start the server (if not already running):
C:\Program Files>"C:\Program Files\seekdb\bin\seekdb.exe" --nodaemon --base-dir C:\seekdb_data --port 2881

Error / Crash Log

Upon execution, the server logs show a vectored exception and background thread crash:

Starting seekdb (OceanBase seekdb ) source revision 1-ebf82ac7a6f1b940f0a5f36ea8bedefeeb626658.
Change working directory to base dir. path='C:\seekdb_data\'
The log file is in the directory: 'C:\seekdb_data\/log/'
[WIN32-TRACE] Vectored exception #1: code=0x80000003 addr=0x000001622037331B tid=15272 (bg-thread)
 Rip=0x000001622037331B RVA=0xFFFF816ACAC7331B Rsp=0x00000008DDEF45A0 Rbp=0x00000000FFFFE961
 StackWalk64 backtrace:
 #00 0x000001622037331B (+0x0)
 #01 0x0000001C00000000 (+0x0)
 #02 0x000001621E1AFF99 (+0x0)
 Stack scan (RVAs): [sp+72]=0xC79500 [sp+96]=0x111FA600 [sp+128]=0xF31F613 [sp+168]=0xF31F613 [sp+424]=0xED20BAD [sp+456]=0x1C22683
[WIN32-TRACE] Background thread crash #1, terminating process to avoid corruption.

Additional Context

  • This issue was reported from an external business context.
  • The crash log indicates a vectored exception (code=0x80000003) in a background thread, leading to process termination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions