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

Segfault when attachment is closed before it's request/statement/etc. [CORE5285] #5563

Closed
firebird-automations opened this issue Jun 20, 2016 · 5 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @AlexPeshkoff

When trying to access some object with already closed attachment initialization code (common for all objects) tries to access already missing attachment. An issue is partially fixed in pull request #⁠37. However, other objects require same fix, not only request.

Commits: a1c576b 5cf6d59

====== Test Details ======

Unfortunatelly, problem can not be reproduced when running in Python + fdb scenario described by Alex:

import os
import fdb

os.environ["ISC_USER"] = 'SYSDBA'
os.environ["ISC_PASSWORD"] = 'masterke'

cdir="c:/mix/firebird/QA/fbt-repo/tmp/"

fbport="3331"
dbfile=cdir+"e30.fdb"

dsn='localhost/'+fbport+':'+dbfile
customTPB = ( [ fdb.isc_tpb_read_committed, fdb.isc_tpb_rec_version, fdb.isc_tpb_nowait ] )

att1 = fdb.connect(dsn=dsn)
trn1 = att1.trans( default_tpb = customTPB )
cur1 = trn1.cursor()
stt='select mon$database_name from mon$database'
cur1.prep(stt)
print( att1.firebird_version )
att1.close()
cur1.execute(stt)
for row in cur1.fetchall():
print(row[0])

Output:

Traceback (most recent call last):
File "http://c5285t.py", line 23, in <module>
cur1.execute(stt)
File "C:\Python27\lib\site-packages\fdb\http://fbcore.py", line 3567, in execute
self._transaction.begin()
File "C:\Python27\lib\site-packages\fdb\http://fbcore.py", line 3978, in begin
raise ProgrammingError("Transaction is permanently closed.")
fdb.fbcore.ProgrammingError: Transaction is permanently closed.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

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

resolution: Fixed [ 1 ]

Fix Version: 3.0.1 [ 10730 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Deferred

Test Details: Any idea how test can be implemented for this ticket ?..

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

How to test:
Attach to database, prepare statement, detach from database, next ask statement to execute or open cursor.
On 3.0.0 this should cause segfault. On current snapshots - expected message like 'statement handle invalid'.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: Deferred => Cannot be tested

Test Details: Any idea how test can be implemented for this ticket ?.. => Unfortunatelly, problem can not be reproduced when running in Python + fdb scenario described by Alex:

import os
import fdb

os.environ["ISC_USER"] = 'SYSDBA'
os.environ["ISC_PASSWORD"] = 'masterke'

cdir="c:/mix/firebird/QA/fbt-repo/tmp/"

fbport="3331"
dbfile=cdir+"e30.fdb"

dsn='localhost/'+fbport+':'+dbfile
customTPB = ( [ fdb.isc_tpb_read_committed, fdb.isc_tpb_rec_version, fdb.isc_tpb_nowait ] )

att1 = fdb.connect(dsn=dsn)
trn1 = att1.trans( default_tpb = customTPB )
cur1 = trn1.cursor()
stt='select mon$database_name from mon$database'
cur1.prep(stt)
print( att1.firebird_version )
att1.close()
cur1.execute(stt)
for row in cur1.fetchall():
print(row[0])

Output:

Traceback (most recent call last):
File "http://c5285t.py", line 23, in <module>
cur1.execute(stt)
File "C:\Python27\lib\site-packages\fdb\http://fbcore.py", line 3567, in execute
self._transaction.begin()
File "C:\Python27\lib\site-packages\fdb\http://fbcore.py", line 3978, in begin
raise ProgrammingError("Transaction is permanently closed.")
fdb.fbcore.ProgrammingError: Transaction is permanently closed.

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