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

Prepared statement needs to be re-prepared

Details

    Description

      Stored procedures contain statement like:
      SET @vartmp = ...;
      PREPARE _stmt FROM @vartmp;
      EXECUTE _stmt;

      Sometimes the execution fails with error: mysql_errno:1615, mysql_warning_count:0, mysql_sqlstate:'HY000', mysql_error:'Prepared statement needs to be re-prepared'

      No idea how to reproduce stably this issue. It happens randomly on various objects from time to time. No DDL operations during the execution.

      MariaDB configuration:
      table_open_cache = 60000
      table_definition_cache = 60000

      I'm happy to provide any information required to solve the problem.

      Attachments

        1. fragment.cpp
          2 kB
          Mike Ilin
        2. fragment.sql
          2 kB
          Mike Ilin

        Issue Links

          Activity

            Mike Ilin Mike Ilin added a comment -

            Seems like MariaDB has a sort of leak, because the error may disappear for some time after restarting mariadb service.

            Mike Ilin Mike Ilin added a comment - Seems like MariaDB has a sort of leak, because the error may disappear for some time after restarting mariadb service.
            Mike Ilin Mike Ilin added a comment - - edited

            I could reproduce the issue doing the following steps:

            1. Run statements from the first part of the attached script fragment.sql
            2. Run code from the file fragment.cpp many thousands of times. I run the c++ code multiple times (thousands of times) in series (i.e. each run in a separate process)
            3. Execute statement : CALL failing_procedure();

            After that it is not possible to call the `failing_procedure`. It fails with message: `Prepared statement needs to be re-prepared.`

            After restarting of MariaDB service the error disappears for some time.

            Mike Ilin Mike Ilin added a comment - - edited I could reproduce the issue doing the following steps: 1. Run statements from the first part of the attached script fragment.sql 2. Run code from the file fragment.cpp many thousands of times. I run the c++ code multiple times (thousands of times) in series (i.e. each run in a separate process) 3. Execute statement : CALL failing_procedure(); After that it is not possible to call the `failing_procedure`. It fails with message: `Prepared statement needs to be re-prepared.` After restarting of MariaDB service the error disappears for some time.

            People

              Unassigned Unassigned
              Mike Ilin Mike Ilin
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.