Raised This Month: $ Target: $400
 0% 

Transaction Handle wiped for no reason


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 12-11-2016 , 14:07   Transaction Handle wiped for no reason
Reply With Quote #1

Minimal test case code:

PHP Code:
    Transaction Txn SQL_CreateTransaction();
    
PrintToChatAll("(1) Transaction Handle: %d"Txn); // fine here
    
    
int AttributeIDs[15]; // Txn is never referenced here
    
int TotalAttribs TF2Attrib_ListDefIndices(WeaponEntityAttributeIDs); // Txn is never referenced here
    
PrintToChatAll("(2) Transaction Handle: %d"Txn); // ...and suddenly Txn is INVALID_HANDLE. WTF? 
Chat printout:

Code:
(1) Transaction Handle: 234029374
(2) Transaction Handle: 0
Logs:

Code:
L 12/11/2016 - 13:54:25: [SM] Exception reported: Invalid handle 0 (error 4)
L 12/11/2016 - 13:54:25: [SM] Blaming: mvm_dropped_weapons.smx
L 12/11/2016 - 13:54:25: [SM] Call stack trace:
L 12/11/2016 - 13:54:25: [SM]   [0] SQL_AddQuery
L 12/11/2016 - 13:54:25: [SM]   [1] Line 519, E:\Servers\Management Tools\Sourcemod Plugins\mvm_dropped_weapons.sp::AddPickedUpWeaponToDatabase
L 12/11/2016 - 13:54:25: [SM]   [2] Line 426, E:\Servers\Management Tools\Sourcemod Plugins\mvm_dropped_weapons.sp::RefineDroppedWeapon
sm_dump_handles showed that the transaction handle still is floating somewhere which suggests this is some memory leak?

Code:
0x0df3013e	mvm_dropped_weapons	Transaction         	-1        // Incidentally, 0x0df3013e	(hex) = 234029374 (decimal)
The workaround that works fine: Call TF2Attributes and then make the transaction.

PHP Code:
    int AttributeIDs[15]; // Txn is never referenced here
    
int TotalAttribs TF2Attrib_ListDefIndices(WeaponEntityAttributeIDs);

    
Transaction Txn SQL_CreateTransaction(); 
But I still want an explanation on why or how the handle got wiped so that this mistake doesn't repeat itself again in the future.

Thanks!

Last edited by Potato Uno; 12-11-2016 at 14:13.
Potato Uno is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode