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

CREATE COLLATION connection lost under Posix [CORE1885] #897

Closed
firebird-issue-importer opened this issue May 6, 2008 · 16 comments
Closed

CREATE COLLATION connection lost under Posix [CORE1885] #897

firebird-issue-importer opened this issue May 6, 2008 · 16 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Submitted by: @pmakowski

Attachments:
core.3741.bz2

Under Windows :
under win32 :

C:\FB21\bin>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'c:\fb21\db\col1.fdb';
SQL> show collation;
There are no collations in this database
SQL> CREATE COLLATION UNICODE_ENUS_CI
CON> FOR UTF8
CON> FROM UNICODE
CON> CASE INSENSITIVE
CON> 'LOCALE=en_US';
Statement failed, SQLCODE = -607
unsuccessful metadata update
-Invalid collation attributes
SQL>
Expected. Our ICU doesn't have locales.

Under Linux and MacOsX :
SQL> create database '127.0.0.1:/Volumes/tempo/firebird_db/coll1.fdb';
SQL> CREATE COLLATION UNICODE_ENUS_CI
CON> FOR UTF8
CON> FROM UNICODE
CON> CASE INSENSITIVE
CON> 'LOCALE=en_US';
Statement failed, SQLCODE = -902
Unable to complete network request to host "127.0.0.1".
-Error reading data from the connection.
Statement failed, SQLCODE = -902
Unable to complete network request to host "127.0.0.1".
-Error reading data from the connection.

Commits: 8aa67e6 6857e76

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Modified by: @pmakowski

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Commented by: @AlexPeshkoff

I've tried with CS 2.1.0 32-bit (standard built).

bash-2.05b#⁠ ./isql -z
ISQL Version: LI-V2.1.0.17798 Firebird 2.1

echo "CREATE COLLATION UNICODE_ENUS_CI FOR UTF8 FROM UNICODE CASE INSENSITIVE 'LOCALE=en_US';" | ./isql -user sysdba -pas masterkey localhost:/tmp/coll1.fdb

Works as expected:
Statement failed, SQLCODE = -607
unsuccessful metadata update
-Invalid collation attributes

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Commented by: @AlexPeshkoff

In HEAD in DEV_BUILD statement fails due to the following assertion:

fb_assert(sym && sym->intlsym_charset_id == constant->nod_desc.getCharSet());

I've found that constant->nod_desc has dynamic text type (127), METD_get_charset_name() successfully finds "NONE" as attachment charset, METD_get_charset() creates dsql_intlsym with charset_id==0. All this looks OK for me, therefore I suppose assert should be fixed. When I commented it out (to experiment), result was as expected - statement succeeded and
SQL> show COLLATION;
UNICODE_ENUS_CI, CHARACTER SET UTF8, FROM EXTERNAL ('UNICODE'), PAD SPACE, CASE INSENSITIVE, 'COLL-VERSION=49.192.5.5;LOCALE=en_US'

Also looks OK.

Adriano, I must say I've failed to reproduce initial bug. If you need more help please provide more details.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Commented by: @pmakowski

So it is a 64bits issue :

on both MacOSX 10.5 and Linux 64 with Classic 64 :
/opt/firebird/bin/isql -z
ISQL Version: LI-V2.1.0.17798 Firebird 2.1
isql -z
ISQL Version: UI-V2.1.0.17798 Firebird 2.1

echo "CREATE COLLATION UNICODE_ENUS_CI FOR UTF8 FROM UNICODE CASE INSENSITIVE 'LOCALE=en_US';" | /opt/firebird/bin/isql -user sysdba -pas masterkey 127.0.0.1:employee
Statement failed, SQLCODE = -902
Unable to complete network request to host "127.0.0.1".
-Error reading data from the connection.
Statement failed, SQLCODE = -902
Unable to complete network request to host "127.0.0.1".
-Error reading data from the connection.
Statement failed, SQLCODE = -902
Unable to complete network request to host "127.0.0.1".
-Error writing data to the connection.
-Broken pipe

echo "CREATE COLLATION UNICODE_ENUS_CI FOR UTF8 FROM UNICODE CASE INSENSITIVE 'LOCALE=en_US';" | isql -user sysdba -pas masterkey 127.0.0.1:/Volumes/tempo/firebird_db/coll1.fdb
Statement failed, SQLCODE = -902
Unable to complete network request to host "127.0.0.1".
-Error reading data from the connection.
Statement failed, SQLCODE = -902
Unable to complete network request to host "127.0.0.1".
-Error reading data from the connection.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Commented by: @AlexPeshkoff

Philippe, unfortunately failed to reproduce. I've installed standard amd64 package, and tried both remote and embedded access. In both cases:
Statement failed, SQLCODE = -607
unsuccessful metadata update
-Invalid collation attributes

I'm afraid you should create core file and sent it to me. In 2.1 all you need to have core file (in /tmp) is just BugcheckAbort = 1 in firebird.conf.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Commented by: @pmakowski

here the core file (Linux CS64)

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Modified by: @pmakowski

Attachment: core.3741.bz2 [ 10880 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 6, 2008

Commented by: @AlexPeshkoff

I've found an exact place, where it dies.

UnicodeUtil::ICU* UnicodeUtil::Utf16Collation::loadICU(
const Firebird::string& collVersion, const Firebird::string& locale,
const Firebird::string& configInfo)
{
ObjectsArray<string> versions;
getVersions(configInfo, versions);

for \(ObjectsArray<string\>::const\_iterator i\(versions\.begin\(\)\); i \!= versions\.end\(\); \+\+i\)
\{
    ICU\* icu = UnicodeUtil::loadICU\(\*i, configInfo\);
    if \(\!icu\)
        continue;

    UErrorCode status = U\_ZERO\_ERROR;

    if \(locale\.hasData\(\)\)
    \{
        int avail = icu\-\>ulocCountAvailable\(\);

        while \(\-\-avail \>= 0\)
        \{
            if \(locale == icu\-\>ulocGetAvailable\(avail\)\)

In this string::operator==() the first thing is done is strlen() of what was returned by ulocGetAvailable(avail). I can only suppose why ulocGetAvailable returns something not acceptable for strlen() - all data is stored in registers and it's already lost for the moment of AV.

Certainly, it will be good to set breakpoint here on a system where it fails. Or add some debugging printf()s. May be Adriano has better ideas?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 7, 2008

Commented by: @asfernandes

The problem is that ulocCountAvailable() is returning 1 instead of 0. I didn't found any specific bug fixed in ICU SVN. This may be a problem caused by our changes to strip locales, but it doesn't cause problems in Windows.

I will investigate further, and maybe contact the ICU guys.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 8, 2008

Modified by: @asfernandes

Version: 2.5 Initial [ 10260 ]

Fix Version: 2.1.1 [ 10223 ]

Fix Version: 2.5 Alpha 1 [ 10224 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 8, 2008

Commented by: @asfernandes

I have not found the exact ICU bug, but adding one locale fix the problem.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 8, 2008

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 28, 2008

Commented by: @pmakowski

test ok and qmtest made

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 28, 2008

Modified by: @pmakowski

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 11, 2015

Commented by: @pavel-zotov

The following statement:

CREATE COLLATION UNICODE_ENUS_CI FOR UTF8 FROM UNICODE CASE INSENSITIVE 'LOCALE=en_US';
show collation;

-- failed on LI-V2.5.4.26821 (though works OK on LI-T3.0.0.31703)

BTW: core_1802.fbt contains now attribute 'platform': 'All' but this statement does not work on all Windows FB versions (2.5 & 3.0). May be one need to change this attribute to: 'platform': 'Linux' ?

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 27, 2015

Modified by: @pavel-zotov

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

QA Status: Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants