[MDEV-23674] CONNECT Engine - (1040) Too many connections when running in trigger Created: 2020-09-04  Updated: 2020-09-08

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - Connect, Triggers
Affects Version/s: 10.3.23
Fix Version/s: 10.3

Type: Bug Priority: Minor
Reporter: nhokworm Assignee: Olivier Bertrand
Resolution: Unresolved Votes: 0
Labels: connect-engine
Environment:

Debian 8.0 (Jessie)


Attachments: PNG File general_log.png    
Issue Links:
Duplicate
duplicates MDEV-23673 CONNECT Engine - (1040) Too many conn... Closed

 Description   

I tried creating the following tables on 2 servers:

// Master
CREATE DATABASE IF NOT EXISTS test;
 
CREATE TABLE IF NOT EXISTS test.test_data (
    id 							INT,
    content						VARCHAR(255),
    PRIMARY KEY (id)
)  ENGINE=INNODB;
 
INSERT INTO test.test_data
VALUES
(1, "Test 01"),
(2, "Test 02");

// Slave
CREATE DATABASE IF NOT EXISTS test;
 
CREATE TABLE IF NOT EXISTS test.test_data (
    id 							INT,
    content						VARCHAR(255)
)   ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='connect=server_connect'
SRCDEF='SELECT id, content FROM test.test_data WHERE %s';
 
CREATE TABLE IF NOT EXISTS test.test_trigger (
    id 							INT,
    content						VARCHAR(255),
    PRIMARY KEY (id)
)   ENGINE=INNODB;
 
DELIMITER //
 
DROP TRIGGER IF EXISTS  test.after_test_trigger;
//
CREATE TRIGGER  test.after_test_trigger
AFTER INSERT ON  test.test_trigger
FOR EACH ROW
BEGIN
SET @test_content = (
SELECT td.content
FROM  test.test_data td
WHERE
td.id = NEW.id
);
END //
INSERT INTO test.test_trigger
VALUES
(1, "Test 01"),
(2, "Test 02");

I've attached general log below. You'll find only the last statement that quit this connection "208", the rest won't. Therefore, when I update 200 rows, it exceeds 200 connections and show error "Too many connections".
Thanks.



 Comments   
Comment by Olivier Bertrand [ 2020-09-08 ]

How can you make 200 updates on a table having only 2 rows?

Comment by nhokworm [ 2020-09-08 ]

I updated 200 rows in my project. You could try inserting 200 rows in this example and set max_connections = 100.

Generated at Thu Feb 08 09:24:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.