TACTIC Open Source
Error when undoing Server Transaction. - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Error when undoing Server Transaction. (/showthread.php?tid=54)



Error when undoing Server Transaction. - listy - 12-12-2019

Hi!
TACTIC 4.7.b01, Python 3.7, CENTOS 7

Trying to undo server transaction, and got this error (Odd-length string):
Code:
  File "/home/apache/tactic/src/tactic/ui/panel/table_layout_wdg.py", line 3444, in handle_row
    html = widget.get_buffer_display()
  File "/home/apache/tactic/src/pyasm/web/widget.py", line 480, in get_buffer_display
    buffer = self.get_buffer(cls)
  File "/home/apache/tactic/src/pyasm/web/widget.py", line 471, in get_buffer
    self.explicit_display(cls)
  File "/home/apache/tactic/src/pyasm/web/widget.py", line 429, in explicit_display
    child = self.get_display()
  File "/home/apache/tactic/src/pyasm/widget/table_element_wdg.py", line 1153, in get_display
    value = zlib.decompress( binascii.unhexlify(value[5:]) )



RE: Error when undoing Server Transaction. - Celton McGrath - 12-12-2019

Hi Listy,

Thanks for sharing this! The storing/retrieving of Python 3 transactions are in fact bugged right now. I'm going to look into this and get it solved ASAP.

Thanks!
Celton


RE: Error when undoing Server Transaction. - listy - 12-12-2019

Looks like HEX strings in the db stored as unicode, so the values is like \u14515\u1451 can not be properly concatenated


RE: Error when undoing Server Transaction. - Celton McGrath - 12-12-2019

Hey Listy!

I think I have a solution. I'll let you know when it gets merged.

https://github.com/Southpaw-TACTIC/TACTIC/pull/1311

Best,

Celton


RE: Error when undoing Server Transaction. - listy - 12-12-2019

(12-12-2019, 04:55 PM)Celton McGrath Wrote: https://github.com/Southpaw-TACTIC/TACTIC/pull/1311
Hi!
Looks prettier and much more consistent.

Will test it with next release! Thanks!


RE: Error when undoing Server Transaction. - dankitchen - 12-19-2019

I took at look and it seems that these fixes were merged into the current 4.7 branch. I just tested and am still experiencing this error. @listy can you verify if it is still a problem on your end (just to make sure I have it in place correctly)?


RE: Error when undoing Server Transaction. - Celton McGrath - 12-19-2019

Hi Dan,

Are you experiencing the error with new transaction or previously created transactions? The original issue is that large transaction are compressed, but were being saved into the database with a couple extra characters, causing the decompression to fail. The fix only fixes new transactions.

If you try to decompress / undo a transaction a corrupted transaction, you can use this code to fix it:


Code:
from pyasm.search import Search
from pyasm.common import Common

transaction = Search.get_by_code("sthpw/transaction_log", "TRANSACTION00001945")
trans = transaction.get_value("transaction")
trans = trans.lstrip("zlib:'b")
trans = trans.rstrip("'")
trans = "zlib:%s" % trans

# test
print(Common.decompress_transaction(trans))

transaction.set_value("transaction", trans)
transaction.commit()

Let me know if you have any different issues with the transaction system.

Thanks!
Celton


RE: Error when undoing Server Transaction. - dankitchen - 12-19-2019

Hey Celton,

I can have a look, in my case it was a csv import that created a bunch of columns on a table. I was trying to undo that and getting the error. I can confirm that simpler small transactions seem to roll back fine.

cheers
-Dan