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

Allow more than one alias for same database [CORE5977] #6229

Closed
firebird-automations opened this issue Dec 28, 2018 · 7 comments
Closed

Allow more than one alias for same database [CORE5977] #6229

firebird-automations opened this issue Dec 28, 2018 · 7 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Volker Rehn (vr2_s18)

While testing php 7 and Firebird 3, I found that the connect routine "ibase_connect" is broken, a confirmed unresolved bug: https://bugs.php.net/bug.php?id=72175 and https://bugs.launchpad.net/ubuntu/+source/php7.0/+bug/1578600.

It means that you cannot open more than one connection to the same database anymore, to e.g.
- run an interleaved query (monitoring queries, stopping a query, ...)
- run queries in parallel using curl or async javascript functions (to utilize Firebird 3 SMP capabilities)

This has worked flawlessly in php versions < 7. However, since php 5.6 hits EOL on 31-12-2018, users must upgrade to php 7 NOW and there is NO WORKAROUND. This severely restricts the use of php and Firebird from now on. It almost seems the php/Firebird extension has been abandoned.

A partial workaround could be to define more than one alias to the same database in databases.conf:

data = D:\web\data\data.fdb
{
DefaultDbCachePages = 100000
}

data2 = D:\web\data\data.fdb
{
DefaultDbCachePages = 100000
}

But Firebird doesn't accept this, firebird.log shows:
File databases.conf contains bad data: Duplicated configuration for database D:\web\data\data.fdb

Can this logic be relaxed?

@firebird-automations
Copy link
Collaborator Author

Modified by: Volker Rehn (vr2_s18)

description: While testing php 7 and Firebird 3, I found that the connect routine "ibase_connect" is broken, a confirmed unresolved bug: https://bugs.php.net/bug.php?id=72175 and https://bugs.launchpad.net/ubuntu/+source/php7.0/+bug/1578600.

It means that you cannot open more than one connection to the same database anymore, to e.g.
- run an interleaved query (monitoring queries, stopping a query, ...)
- run queries in parallel using curl or async javascript functions (to utilize Firebird 3 SMP capabilities)

This has worked flawlessly in php versions < 7. However, since php 5.6 hits EOL on 31-12-2018, users must upgrade to php 7 NOW and there is NO WORKAROUND. This severlely restricts the use of php and Firebird from now on. It almost seems the php/Firebird extension has been abandoned.

A partial workaround could be to define more than one alias to the same database in databases.conf:

data = D:\web\data\data.fdb
{
DefaultDbCachePages = 100000
}

data2 = D:\web\data\data.fdb
{
DefaultDbCachePages = 100000
}

But Firebird doesn't accept this, firebird.log shows:
File databases.conf contains bad data: Duplicated configuration for database D:\web\data\data.fdb

Can this logic be relaxed?

=>

While testing php 7 and Firebird 3, I found that the connect routine "ibase_connect" is broken, a confirmed unresolved bug: https://bugs.php.net/bug.php?id=72175 and https://bugs.launchpad.net/ubuntu/+source/php7.0/+bug/1578600.

It means that you cannot open more than one connection to the same database anymore, to e.g.
- run an interleaved query (monitoring queries, stopping a query, ...)
- run queries in parallel using curl or async javascript functions (to utilize Firebird 3 SMP capabilities)

This has worked flawlessly in php versions < 7. However, since php 5.6 hits EOL on 31-12-2018, users must upgrade to php 7 NOW and there is NO WORKAROUND. This severely restricts the use of php and Firebird from now on. It almost seems the php/Firebird extension has been abandoned.

A partial workaround could be to define more than one alias to the same database in databases.conf:

data = D:\web\data\data.fdb
{
DefaultDbCachePages = 100000
}

data2 = D:\web\data\data.fdb
{
DefaultDbCachePages = 100000
}

But Firebird doesn't accept this, firebird.log shows:
File databases.conf contains bad data: Duplicated configuration for database D:\web\data\data.fdb

Can this logic be relaxed?

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

First, are you using v3 and/or embedded engine for the first time?

If so, have you read the release notes? The database 'mode' of the embedded engine has changed in v3.0.

Support for multiple aliases for the same database file and support for multiple connections to a single database are 2 distinct features.

The alias problem is likely due to a need to ensure that a database can only be opened by a single SuperServer or SuperClassic engine instance at a time (DB corruption would result if allowed). By trying to use different local file aliases, the engine is likely detecting that the database is already opened by another instance. Try using non-local (ie. "localhost:{Alias}) in your connection strings.

@firebird-automations
Copy link
Collaborator Author

Commented by: Volker Rehn (vr2_s18)

Sean, thanks for your input, I have double checked and can exclude that the multiple alias restriction is due to Firebird running in embedded mode. I have verified connection strings, they are something like 127.0.0.1/3053:data, therefore not hostless. One v3 server instance, and another, v2.5.8 on the default port, which doesn't matter here. Been using v3 since its alpha stage and in production since 2016 at several sites. And every Firebird version from 1.0 to 4.0. To reproduce just define another alias in your databases.conf to a database already aliased, then connect to one of these aliases.

Running Firebird as SuperServer and not in embedded mode, I only went from apache 2.4.4 / php 5.4 to apache 2.4.37 / php 7.3. Didn't even touch the Firebird 3 server.

> Support for multiple aliases for the same database file and support for multiple connections to a single database are 2 distinct features.

Multiple connections to a single database of course work as expected, up to php < 7 or from other clients. Multiple aliases for the same database are probably disallowed because otherwise it would be easy to create conflicting database configurations. I wouldn't need this workaround if there wasn't this unexpected connect bug in php > 7.0. I mean "connect" - which more important function do you have in a connectivity lib? Right now I'm running out of ideas. I can't easily replace the php middle tier by nodejs or python because it contains php-based connectivity libs for Excel, ODBC and SAP. And I guess anyone using php and Firebird is affected, the bug means no parallel / overlapping connections to the same Firebird database. Even consecutive connects encapsulated in functions render previous outer scope connection handles to the same database useless. Pretty nasty.

I know this issue doesn't really belong here, but since the bug has been reported in the php tracker two and a half years ago with no effect, and it affects a part of the project's user base, I'm taking this to a wider audience, hoping that together we can come up with a solution.

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Multiple aliases are not prohibited in databases.conf - only configuration section must be single. Try this:

****************************************
data = D:\web\data\data.fdb
{
DefaultDbCachePages = 100000
}

data2 = D:\web\data\data.fdb
****************************************

Dit it help?

@firebird-automations
Copy link
Collaborator Author

Commented by: Volker Rehn (vr2_s18)

Thanks Alex, that works and helps tricking the broken php-Firebird connect function in some cases. This ticket can be closed.

php-Firebird's future seems to depend on Marius: https://wiki.php.net/rfc/removal_of_dead_sapis_and_exts#extinterbase.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

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

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

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

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

No branches or pull requests

1 participant