Issue Details (XML | Word | Printable)

Key: CORE-5985
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Pavel Zotov
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Regression: ROLE does not passed in ES/EDS (specifying it in the statement is ignored)

Created: 15/Jan/19 09:44 AM   Updated: 16/Feb/19 08:43 AM
Component/s: Engine
Affects Version/s: 4.0 Alpha 1, 3.0.4
Fix Version/s: 4.0 Beta 1, 3.0.5

File Attachments: None
Image Attachments:

1. c5985-screen-for-LI-3-0-5-33085.png
(73 kB)

QA Status: Done successfully


 Description  « Hide
Consider following script (correct here name of alias - i used 'employee'):
===
    connect 'localhost:employee' user 'SYSDBA' password 'masterkey';
    create user foo password '123';
    create user bar password '456';
    commit;
    create role worker;
    create role manager;
    commit;

    grant worker to foo;
    grant manager to bar;
    commit;

    --connect 'localhost:employee' user 'BAR' password '456';
    connect 'localhost:employee' user 'BAR' password '456' role manager;

    set list on;
    select rdb$get_context('SYSTEM', 'DB_NAME') as where_i_am, mon$user who_am_i, mon$role whats_my_rtole
    from mon$attachments
    where mon$attachment_id = current_connection;

    set term ^;
    execute block returns(where_i_am varchar(255), who_am_i varchar(31), whats_my_role varchar(31)) as
        declare v_sttm varchar(2048);
        declare v_user varchar(31) = 'foo';
        declare v_pswd varchar(31) = '123';
        declare v_role varchar(31) = 'WORKER';
        declare v_extd varchar(255);
    begin
        v_extd = 'localhost:' || rdb$get_context('SYSTEM', 'DB_NAME');
        v_sttm = 'select rdb$get_context(''SYSTEM'', ''DB_NAME''), mon$user, mon$role from mon$attachments where mon$attachment_id = current_connection';
        
        execute statement
            v_sttm
            on external v_extd
            as user v_user password v_pswd role v_role
        into
            where_i_am, who_am_i, whats_my_role;
        
        suspend;
 
    end
    ^
    set term ;^
    commit;

    connect 'localhost:employee' user 'SYSDBA' password 'masterkey';
    drop user foo;
    drop user bar;
    commit;
    revoke all on all from foo;
    revoke all on all from bar;
    drop role worker;
    drop role manager;
    commit;
    show version;
===

On 2.5.9.27126 out will be as expected:

WHERE_I_AM C:\MIX\FIREBIRD\FB25\EXAMPLES\EMPBUILD\EMPLOYEE.FDB
WHO_AM_I BAR
WHATS_MY_RTOLE MANAGER

WHERE_I_AM C:\MIX\FIREBIRD\FB25\EXAMPLES\EMPBUILD\EMPLOYEE.FDB
WHO_AM_I FOO
WHATS_MY_ROLE WORKER


On 3.0.5.33086 and 4.0.0.1378:

WHERE_I_AM C:\MIX\firebird\fb40\examples\empbuild\employee.fdb
WHO_AM_I BAR
WHATS_MY_RTOLE MANAGER

WHERE_I_AM C:\MIX\FIREBIRD\FB40\EXAMPLES\EMPBUILD\EMPLOYEE.FDB
WHO_AM_I FOO
WHATS_MY_ROLE NONE <<<<<<<<<<<<<<<<<<<<<<<<<<< [ Why ? ] <<<<<




 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 18/Jan/19 02:01 PM
Can not reproduce (used exactly your script with default config):

WHERE_I_AM /usr/home/firebird/HEAD/gen/Debug/firebird/examples/empbuild/employee.fdb
WHO_AM_I BAR
WHATS_MY_RTOLE MANAGER

WHERE_I_AM /usr/home/firebird/HEAD/gen/Debug/firebird/examples/empbuild/employee.fdb
WHO_AM_I FOO
WHATS_MY_ROLE WORKER

ISQL Version: LI-T4.0.0.1384-dev Firebird 4.0 Alpha 1
Server version:
Firebird/Linux/AMD/Intel/x64 (access method), version "LI-T4.0.0.1384-dev Firebird 4.0 Alpha 1"
Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-T4.0.0.1384-dev Firebird 4.0 Alpha 1/tcp (fbs3)/P16:C"
Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-T4.0.0.1384-dev Firebird 4.0 Alpha 1/tcp (fbs3)/P16:C"
on disk structure version 13.0


WHERE_I_AM /usr/home/firebird/B3_0_Release/gen/Debug/firebird/examples/empbuild/employee.fdb
WHO_AM_I BAR
WHATS_MY_RTOLE MANAGER

WHERE_I_AM /usr/home/firebird/B3_0_Release/gen/Debug/firebird/examples/empbuild/employee.fdb
WHO_AM_I FOO
WHATS_MY_ROLE WORKER

ISQL Version: LI-V3.0.5.33084-dev Firebird 3.0
Server version:
Firebird/Linux/AMD/Intel/x64 (access method), version "LI-V3.0.5.33084-dev Firebird 3.0"
Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-V3.0.5.33084-dev Firebird 3.0/tcp (fbs3)/P15:C"
Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-V3.0.5.33084-dev Firebird 3.0/tcp (fbs3)/P15:C"
on disk structure version 12.0

Pavel Zotov added a comment - 18/Jan/19 05:24 PM
Just checked again, on 3.0.5.33085 -- bug *does* exist, see attached screen.
My config:
=======
[root@localhost firebird]# cat firebird.conf
RemoteServicePort = 3050

#include /opt/scripts/fb30.conf.SC
include /opt/scripts/fb30.conf.SS

DeadlockTimeout = 10
BugCheckAbort=1
TempDirectories = /tmp
AuthServer = Legacy_Auth,Srp
AuthClient = Legacy_Auth,Srp
WireCrypt = Enabled
UserManager = Legacy_UserManager,Srp
UdfAccess = Restrict UDF
ExternalFileAccess = Full

[root@localhost firebird]# cat /opt/scripts/fb30.conf.SS
ServerMode=Super
DefaultDbCachePages = 999K
FileSystemCacheThreshold = 65535K

TempCacheLimit = 1G
TempSpaceLogThreshold = 512M

LockHashSlots = 49999
LockMemSize = 50M
IpcName = fb30SS
=======

Alexander Peshkov added a comment - 21/Jan/19 02:46 PM
Tried with your configuration, tried both debug & release builds - still not reproduced. What else can I miss?

Pavel Zotov added a comment - 21/Jan/19 03:28 PM
> What else can I miss?

Just checked on LI-V3.0.5.33077, *special* build with replication support, on another POSIX host (i.e. not CentOS):
=======
root@f51-db02:/opt/scripts# cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
=======

+ config:
=======
AuthClient = Legacy_Auth, Srp
AuthServer = Legacy_Auth, Srp
BugCheckAbort = 1
DefaultDbCachePages = 10K
ExtConnPoolLifeTime = 900
ExtConnPoolSize = 100
FileSystemCacheThreshold = 999999K
LockHashSlots = 30011
LockMemSize = 30M
RemoteAuxPort = 3060
RemoteServicePort = 3050
ServerMode=Super
TempBlockSize = 2048576
TempCacheLimit = 1500M
TempDirectories = /dev/shm;/tmp
TempSpaceLogThreshold = 1000M
UserManager = Srp, Legacy_UserManager
WireCompression = true
WireCrypt = Enabled
=======

-- result is the same (i.e. with bug).

Checked one more time on WI-V3.0.5.33084, *standard* build (downloaded from official FB site with snapshots folder), -- and also got wrong output.

So... i really do not know what the reason that it works OK on your environment...

I can force EDS connection to stay in long pause when it is establishes (using UDF or simulate this delay on "pure PSQL" with attempt to insert duplicate iondex key - no matter). And gather full memory dumps + stack trace for this state, both on Linux and Windows. And send this info to you and Vlad.

Can this help in investigation ?

Alexander Peshkov added a comment - 21/Jan/19 05:23 PM
Not needed. I've reproduced a bug on 32-bit build using gcc 6.4.

Alexander Peshkov added a comment - 22/Jan/19 03:18 PM
Issue was reproduced unstable due to dependence of it from order of items in DPB which in turn depends upon a lot of other factors like length of authentication block in it.