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

REPEAT (0,max_allowed_packet) causing client disconnect at max_allowed_packet-4 to max_allowed_packet size

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.5, 10.6, 10.11, 11.1(EOL), 11.2(EOL), 11.4, 11.5(EOL)
    • N/A
    • Scripts & Clients
    • None

    Description

      11.5.0 e4afa610539ae01164485554e2de839bea9de816 (Optimized)

      11.5.0-opt>SELECT REPEAT (0,@@GLOBAL.max_allowed_packet+1);  # Correct
      +------------------------------------------+
      | REPEAT (0,@@GLOBAL.max_allowed_packet+1) |
      +------------------------------------------+
      | NULL                                     |
      +------------------------------------------+
      1 row in set, 1 warning (0.000 sec)
       
      11.5.0-opt>SHOW WARNINGS; 
      +---------+------+------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                      |
      +---------+------+------------------------------------------------------------------------------+
      | Warning | 1301 | Result of repeat() was larger than max_allowed_packet (16777216) - truncated |
      +---------+------+------------------------------------------------------------------------------+
      1 row in set (0.000 sec)
       
      11.5.0-opt>SELECT REPEAT (0,@@GLOBAL.max_allowed_packet);  # Fails
      ERROR 2013 (HY000): Lost connection to server during query
       
      11.5.0-opt>SELECT REPEAT (0,@@GLOBAL.max_allowed_packet-1);  # Fails
      ERROR 2013 (HY000): Lost connection to server during query
       
      11.5.0-opt>SELECT REPEAT (0,@@GLOBAL.max_allowed_packet-4);  # Fails
      ERROR 2013 (HY000): Lost connection to server during query
       
      11.5.0-opt>SELECT REPEAT (0,@@GLOBAL.max_allowed_packet-5);  # Correct
      # Large output commences
      

      Confirmed present in 10.5-11.5

      Attachments

        Activity

          Doesn't look like a bug. You get the packet size larger than the max allowed packet and the client cannot receive that (or the server cannot send).

          serg Sergei Golubchik added a comment - Doesn't look like a bug. You get the packet size larger than the max allowed packet and the client cannot receive that (or the server cannot send).
          Roel Roel Van de Paar added a comment - - edited

          serg Sure, but there is an offset difference here - like an off-by-1 bug, but in this case it is off-by-1 to off-by-4/5.
          IOW, there is an offset of about 5 bytes unaccounted for.
          (Scroll down in the testcase; JIRA has cut it off at exactly the most [non-]opportune spot )

          Roel Roel Van de Paar added a comment - - edited serg Sure, but there is an offset difference here - like an off-by-1 bug, but in this case it is off-by-1 to off-by-4/5. IOW, there is an offset of about 5 bytes unaccounted for. (Scroll down in the testcase; JIRA has cut it off at exactly the most [non-] opportune spot )

          max_allowed_packet limits the size of the network packet that the server sends to the client.
          When your result is already max_packet_size, you cannot wrap it into a packet with the additional packet header and stuff — https://mariadb.com/kb/en/result-set-packets/ — and still be under max_packet_size

          serg Sergei Golubchik added a comment - max_allowed_packet limits the size of the network packet that the server sends to the client. When your result is already max_packet_size, you cannot wrap it into a packet with the additional packet header and stuff — https://mariadb.com/kb/en/result-set-packets/ — and still be under max_packet_size

          Ah, understood, thank you for clarifying.

          Roel Roel Van de Paar added a comment - Ah, understood, thank you for clarifying.

          People

            sanja Oleksandr Byelkin
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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