FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.24k stars 212 forks source link

Bug in ESQL applications [CORE5318] #5594

Closed firebird-automations closed 8 years ago

firebird-automations commented 8 years ago

Submitted by: Ehmmm (ehmmm.firebird)

Copied (and bit edited) from https://groups.yahoo.com/neo/groups/firebird-support/conversations/messages/129467 (archive)

Hi, we have server with Debian 6.0 squeeze (edit: it is 7.1 wheezy, but I think that on squeeze I could see it too) and there we have Firebird 2.5.2 (superclassic) which sometimes hangs and I don't know why. So my idea was to install there FB 2.5.6. I downloaded FB 2.5.6 superclassic i686 (debian is amd64 but previous firebird seems to be i686 so I decided to continue using i686) tar.gz, extracted it and executed install.sh. I think I was quite successful. I didn't make backups of *.fdb files, I only copied older security2.fdb into /opt/firebird and copied some init script from /opet/firebird/misc into /etc/init.d My PHP webapges work well, my Python apps work well, FlameRobin works well. The only problem I have with some old C programs running on the same server, precompiled via GPRE utility. These C apps fail for example on then line (just example) EXEC SQL FETCH cur_al...:

int i, id, status;

EXEC SQL CONNECT DB USER '...' PASSWORD '...'; EXEC SQL SET TRANSACTION READ WRITE WAIT ISOLATION LEVEL READ COMMITTED;

EXEC SQL DECLARE cur_al CURSOR FOR SELECT id_blabla, status FROM blabla;

EXEC SQL OPEN cur_al; while(SQLCODE == 0) { EXEC SQL FETCH cur_al INTO :id, :status; if (SQLCODE == 0) { ... } }

EXEC SQL CLOSE cur_al;

...

It throws error -901 and messages "Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements" and "request synchronization error".

I'm not author of these C apps and I'm not very skilled in C on linux, I only found some Makefile so I tried run "make". But it didn't help.

What should I try? Should I look somewhere for some libraries?

The most interesting for me is that when I download and install FB 2.5.5 or 2.5.4 (I must admit that upgrading/downgrading firebird inside 2.5.x is quite easy) then these C apps seems to work correctly. (?) Is there any explanation for this?

-----

Copied from: https://groups.yahoo.com/neo/groups/firebird-support/conversations/messages/129471 (archive)

Adding some notes:

Examples stat3.e and stat5.e from /opt/firebird/examples/stat/ don't work, while stat2.e works. I'm getting the same -901 "request synchronization error".

Steps to reproduce:

Extract somewhere FirebirdCS-2.5.6.27020-0.i686.tar.gz "su" to be root. Run install.sh, creates backup, ask for password. Replace /opt/firebird/security2.fdb with symlink to reallife security2.fdb. Get /etc/init.d/firebird from somewhere. service firebird start

cd /opt/firebird/examples/stat cp ../include/example.h . /opt/firebird/bin/gpre -d employee.fdb stat2.e export ISC_USER=sysdba export ISC_PASSWORD=... export ISC_DATABASE=employee.fdb cc -lfbclient stat2.c -o stat2 ./stat2 (Same for stat3.e and stat5.e)

Like I said, in FB 2.5.6 stat3 and stat5 throw error. If I do the same with FB 2.5.5 then these examples work.

Commits: FirebirdSQL/firebird@bdfab9cfd829a4c9420b7f440585412a319d984c

firebird-automations commented 8 years ago

Commented by: @AlexPeshkoff

Works for me (on fresh gentoo):

localhost bin #⁠ cd /opt/firebird/examples/stat localhost stat #⁠ cp ../include/example.h . localhost stat #⁠ /opt/firebird/bin/gpre -d employee.fdb stat2.e localhost stat #⁠ export ISC_USER=sysdba localhost stat #⁠ export ISC_PASSWORD=... localhost stat #⁠ export ISC_DATABASE=employee.fdb localhost stat #⁠ cc -lfbclient stat2.c -o stat2 localhost stat #⁠ ./stat2 President: Oliver H. Bender Phone #⁠: (408) 555-1234 x255 localhost stat #⁠ /opt/firebird/bin/gpre -d employee.fdb stat3.e localhost stat #⁠ cc -lfbclient stat3.c -o stat3 localhost stat #⁠ ./stat3

DEPARTMENT LOCATION HEAD DEPARTMENT

Marketing San Francisco Sales and Marketing
Software Products Div. Monterey Engineering
Software Development Monterey Software Products Div.
Field Office: Singapore Singapore Pacific Rim Headquarters localhost stat #⁠

firebird-automations commented 8 years ago

Commented by: Ehmmm (ehmmm.firebird)

Well, I tried some almost fresh debian jessie (v.8) and squeeze (v.6) virtual machines and examples stat3 and stat5 don't work in FB2.5.6. And if I downgrade to FB2.5.5 then they work.

Do you have any ideas?

firebird-automations commented 8 years ago
Modified by: @AlexPeshkoff assignee: Alexander Peshkov \[ alexpeshkoff \]
firebird-automations commented 8 years ago

Commented by: @AlexPeshkoff

Reproduced

firebird-automations commented 8 years ago
Modified by: @AlexPeshkoff summary: from FB 2\.5\.2 to 2\.5\.6 and C application =\> Bug in ESQL applications
firebird-automations commented 8 years ago

Commented by: @AlexPeshkoff

Backported simplified fix for same problem from FB3

firebird-automations commented 8 years ago
Modified by: @AlexPeshkoff status: Open \[ 1 \] =\> Resolved \[ 5 \] resolution: Fixed \[ 1 \] Fix Version: 2\.5\.7 \[ 10770 \]