Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: ROLE does not passed in ES/EDS (specifying it in the statement is ignored) [CORE5985] #6237

Closed
firebird-automations opened this issue Jan 15, 2019 · 11 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Attachments:
c5985-screen-for-LI-3-0-5-33085.png

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 ? ] <<<<<

Commits: ee1881e 7f2e326

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

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

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

Attachment: c5985-screen-for-LI-3-0-5-33085.png [ 13317 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

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

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Tried with your configuration, tried both debug & release builds - still not reproduced. What else can I miss?

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

> 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 ?

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Not needed. I've reproduced a bug on 32-bit build using gcc 6.4.

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 1 [ 10750 ]

Fix Version: 3.0.5 [ 10885 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment