Bug #58228 Calling an endless procedure results in segmentation fault
Submitted: 16 Nov 2010 14:17 Modified: 16 Dec 2010 14:22
Reporter: Alexander Bogardi Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S3 (Non-critical)
Version:5.1.23 OS:Solaris (mysql Ver 14.14 Distrib 5.1.23-rc, for sun-solaris2.8 (sparc) using readline 5.2)
Assigned to: CPU Architecture:Any

[16 Nov 2010 14:17] Alexander Bogardi
Description:
My stored procedure is called provoke_segfault.sql. Its an endless loop that defines and sets variables. I removed all interaction with databases but the segfault still happens.

1. I log in to the database server using the mysql client.
2. I source the procedure provoke_segfault.sql
3. I run it using CALL provoke_segfault.

It runs until a segfault happens on the client after: 1 day 2 hours 10 min 9.33 sec.

How to repeat:
Do the above mentioned steps. provoke_segfault.sql looks like this:

DELIMITER //
DROP PROCEDURE IF EXISTS Provoke_segfault;

CREATE PROCEDURE Provoke_segfault()
BEGIN

            DECLARE i INT DEFAULT 1;

            WHILE i < 10 do
            BEGIN

            DECLARE entity_obj_id          bigint;
            DECLARE customer_number        bigint;
            DECLARE subscription_id        bigint;
            DECLARE subscription_id2       bigint;
            DECLARE clientsystem_id        varchar(10);
            DECLARE subscription_type      varchar(5);
            DECLARE creation_date          date;
            DECLARE user_chdate            date;
            DECLARE ctime                  datetime;
            DECLARE subscription_status    enum('A','D','F','G','I','O','P','R','X');
            DECLARE activation_date        date;
            DECLARE deactivation_date      date;
            DECLARE subscription_number    varchar(15);                               
            DECLARE payment_method         enum('POST','PRE');
            DECLARE imsi                   varchar(10);
            DECLARE imsi_valid             tinyint;
            DECLARE roam                   tinyint;
            DECLARE istt_merge_date        date;
            DECLARE istt_receive_datetime  datetime;
            DECLARE istt_creation_date     timestamp;
            DECLARE istt_replace_date      datetime;
            DECLARE cusin_msg_id           bigint;

            -- SET i=i+1;
            SET         entity_obj_id= 88888;
            SET       customer_number= 1005521;
            SET       subscription_id= 10101054;
            SET      subscription_id2= 10101054;
            SET      clientsystem_id= 'GSM-AHS';
            SET    subscription_type= 'DN';
            SET        creation_date= '2008-09-04';
            SET          user_chdate= '2008-09-04';
            -- SET                ctime= '2008-09-04 15:06:06';
            SET ctime= concat('2010-05-0', floor(1 + rand()*8), ' 15:06:06'); 
            SET  subscription_status= 'D';
            SET      activation_date= '2008-09-04';
            SET   deactivation_date= NULL;
            -- SET subscription_number= '46730992440';
            SET subscription_number= concat('467309', floor(10000 + rand() * 80000)) ;

            SET      payment_method= 'POST';
            SET                imsi= concat('2', floor(100000000 + rand() * 800000000));
            SET          imsi_valid= 0;
            SET                roam= 0;
            SET      istt_merge_date= '2010-05-10';
            SET istt_receive_datetime= '2010-05-10 09:16:28';
            SET  istt_creation_date= '2010-05-10 09:16:28';
            SET   istt_replace_date= '2010-05-10 09:16:30';
            SET        cusin_msg_id= 31123;

                select sleep(1);

                END;
                END while;

END //
DELIMITER ;
[16 Nov 2010 14:19] MySQL Verification Team
if it is the client segfaulting, this could be bug 33976
[16 Nov 2010 14:22] Alexander Bogardi
Yes it is the client thats segfaulting
[16 Nov 2010 14:22] MySQL Verification Team
Could you please try the latest released version. Thanks in advance.
[17 Dec 2010 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".