Are IronPython scripts known to lock up?

wpostmawpostma Posts: 22
edited February 9, 2016 11:28AM in SQL Data Generator
I am experiencing frequent freezes in SQL Data Generator. I am using a trial version. My SQL Server 2016 DB has about 150 tables. About 100 of those tables have a field named ExtJSON, and these are generated with an IronPython script as shown in the code block below.


Frequently, especially when I'm typing text into the Find box at the top left, it starts generating a preview immediately, and freezes. I can not cancel (the cancel button just grays out when I click it.) One core on my PC is locked at 100% cpu, and I believe you have probably got an IronPython Eval(pythonScript) running, and it's not terminating. Memory usage is not very high (120 megs). I have to kill SQL data generator. I save frequently. But this bug is bad enough to make me rethink purchasing the product.

If I never ever use the Find(filter) box, this never happens. It always freezes while generating script data.

Screenshot:
nJQ1fEC.png

Script:

# GENERATE A JSON STRING
import clr

#ironpython-style random:
from System import Random
random = Random()

def choice(alist):
   i = random.Next(len(alist))
   return alist[i]

def choices(spacer,alist,acount):
   return spacer.join([choice(alist) for _ in range(acount)])
   
def randrange(min,max):
    return random.Next(min,max)

def main(config):
    return "{ "always": "+str(randrange(10,1000))+", ""+choices( "_", ["foo", "bar", "bat","baz","baf","min","max", "age", "id", "external","internal"], 2)+"": "+str(randrange(0,5000))+" }"

Comments

  • Hello Warren,

    Python code is not known to lockup unless there is an infinite loop or too much memory allocated. Since the issue is only happening with the find filter box and not if you don't touch it I would think this is a bug with that dialog box. I can't think of any workaround since it's maxing the CPU and I can't think of any way to split the script up where this bug wouldn't be run into.

    Sorry there wasn't a solution for this bug.
    Allen LeVan
    Red Gate Software
    US Product Support
Sign In or Register to comment.