Issue Details (XML | Word | Printable)

Key: CORE-2632
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Vlad Khorsun
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Invalid BLOB ID when working with monitoring tables

Created: 16/Sep/09 09:25 AM   Updated: 28/Jul/11 09:59 AM
Component/s: Engine
Affects Version/s: 2.5 Beta 1, 2.5 Beta 2, 2.1.3
Fix Version/s: 2.5 RC1, 2.1.4

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
If first query with monitoring tables in transaction not returned blob fields to the client (i.e. blob fields was not present in SELECT list) than subsequent queries in the same transaction which referenced blob fields will fail with "Invalid BLOB ID" error.

The reason is :
- first query in transaction involving any monitoring table triggers creation of monitoring snapshot for this transaction
- when snapshot is created some temporary blobs is created too and bound to the transaction and to the request
- if this blobs not passed to the client its remains bound to the request
- when request finish its execution all temporary blobs bound to it released
- when another request going to open blob it fails

Example


firebird\bin>isql -user SYSDBA -pass masterkey s:\TEST.FDB -ch UNICODE_FSS
Database: s:\TEST.FDB, User: SYSDBA
SQL> select 1 from mon$database;

    CONSTANT
============
           1

SQL> select mon$sql_text from mon$statements;

     MON$SQL_TEXT
=================
              0:1
==============================================================================
MON$SQL_TEXT:
Statement failed, SQLSTATE = 42000
invalid BLOB ID

SQL> commit;
SQL> select mon$sql_text from mon$statements;

     MON$SQL_TEXT
=================
              0:1
==============================================================================
MON$SQL_TEXT:
select mon$sql_text from mon$statements
==============================================================================

SQL> select mon$sql_text from mon$statements;

     MON$SQL_TEXT
=================
              0:1
==============================================================================
MON$SQL_TEXT:
select mon$sql_text from mon$statements
==============================================================================

SQL> exit;


Note, i used UNICODE_FSS connection charset. This is needed to avoid involving transliteration filter which is used by the engine if connection charset is different from blob field charset (see also patch for CORE-2602)

 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun added a comment - 16/Sep/09 09:38 AM
The solution is to unbind from request temporary blob's created for monitoring tables

Vlad Khorsun added a comment - 16/Sep/09 08:08 PM
Workaround for FB 2.1.3 could be

a) Issue only one query of monitoring tables in transaction, or

b) Run
  select mon$sql_text from mon$statements where mon$sql_text is not null

  as the first query in transaction (you don't have to read blobs, just obtain its ID's)


Pavel Cisar added a comment - 28/Jul/11 09:59 AM
QA test added.