Linux Client prepare statement can systematically crashes server if 4 SMALLINT 
in a row
---------------------------------------------------------------------------------------

                 Key: CORE-5473
                 URL: http://tracker.firebirdsql.org/browse/CORE-5473
             Project: Firebird Core
          Issue Type: Bug
          Components: API / Client Library
    Affects Versions: 2.5.6
         Environment: Server: SuperServer on Linux Ubuntu 16 (14 as well) 
64bit;  C++ Client on Linux using directly the C API (gcc 5.4 64bit)
            Reporter: Philippe Truc


1. A simple table:

CREATE TABLE PersonalInfos
(
        Id                      BIGINT NOT NULL,
        Birthday                        TIMESTAMP,
        NbChildren                      SMALLINT DEFAULT 0,
        Status                  SMALLINT DEFAULT 0,
        PreferredLang                   SMALLINT DEFAULT 0,
        Sex                     SMALLINT DEFAULT 0 

);

ALTER TABLE PersonalInfos ADD PRIMARY KEY ( Id );

CREATE SEQUENCE seq_PersonalInfos;

2. A simple stored procedure:

CREATE OR ALTER PROCEDURE spc_PersonalInfo(
                        Sex SMALLINT
                        ,PreferredLang SMALLINT
                        ,Status SMALLINT
                        ,NbChildren SMALLINT
                        ,Birthday TIMESTAMP
                        )
        RETURNS(Id BIGINT)
AS BEGIN
        SELECT NEXT VALUE FOR seq_PersonalInfos FROM RDB$DATABASE INTO :Id;
        INSERT INTO PersonalInfos(
                Id
                ,Sex
                ,PreferredLang
                ,Status
                ,NbChildren
                ,Birthday
                ) VALUES (
                        :Id
                        ,:Sex
                        ,:PreferredLang
                        ,:Status
                        ,:NbChildren
                        ,:Birthday
                );
END #

3.  Run SuperSrerver 2.6 on Linux Ubuntu 16 (same on Ubuntu 14) 64 bit.

4. Execute stored procedure in isql-fb on Linux: no issue:

SQL> execute procedure spc_personalinfo 0,0,0,0,'2017-02-01';
ID
===================
1


3. Connect with C++ client on windows 10 (VS2013): no issue. Very same client 
compiled and run on Linux (gcc54  64bit) : crashes systematically server on 
calling: isc_dsql_prepare
On client side: [SQLCODE=-902]

4. Create a similar stored procedure, but with only 3 SMALLINT:

CREATE OR ALTER PROCEDURE spc_PersonalInfo2(
                        PreferredLang SMALLINT
                        ,Status SMALLINT
                        ,NbChildren SMALLINT
                        ,Birthday TIMESTAMP
                        )
        RETURNS(Id BIGINT)
AS BEGIN
        SELECT NEXT VALUE FOR seq_PersonalInfos FROM RDB$DATABASE INTO :Id;
        INSERT INTO PersonalInfos(
                Id
                ,Sex
                ,PreferredLang
                ,Status
                ,NbChildren
                ,Birthday
                ) VALUES (
                        :Id
                        ,0
                        ,:PreferredLang
                        ,:Status
                        ,:NbChildren
                        ,:Birthday
                );
END #

--> Works without problem anymore.

Hypothesis: 4 SMALLINT = 1 BIGINT, maybe a confusion in the Linux client API? I 
have no idea of the Firebird code, just the only pattern I could find to 
explain this systematic crash while I have dozens of other stored procedures 
and tables without issues.




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to