Hola Francesc,

Attached is a test that generates  the Seg Fault.



#
# ____________________ segFaultTest.py ___________________________________________
# test for generating a segmentation fault using pytables
# main function is doit() at EOF
# doit(3000,100000) Makes 3000 nodes in root, each with nine sub-nodes. 100,000 leaves are then randomly attached.
# On OSX this SegFaults after 7000 leaves. Smaller may also but below a certain size runs OK.
#
# In this simulation of all Leaf classes are identical. In the real-world problem they are different
# but are of similar dimensions.
#
# author: drw 20070812

import random, tables

class LeafClass1(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass2(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass3(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass4(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass5(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass6(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass7(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass8(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

class LeafClass9(tables.IsDescription):
    L1    = tables.UInt8Col()         # unsigned short int for day number
    L2    = tables.UInt16Col()        # seconds from midight (=0 and 86400). 10h00 = 36000, 16h00 = 57600
    L3    = tables.UInt16Col()        # time that T was effected (as reported by the engine)
    L4    = tables.UInt32Col()        # O identifier. A unique natural number
    L5    = tables.Float32Col()       # P of 1 unit
    L6    = tables.UInt16Col()        # Vo
    L7    = tables.Float32Col()       # Va
    L8    = tables.UInt64Col()        # 64 bit mask of the O's flags (see flags.py)
    L9    = tables.StringCol(16)      # BBT Refs: A number string prepended by '@#'

def makeNodes(h5file, nameString):
    try:
        node0   = h5file.createGroup("/", nameString)
        # Append the Orderbook nodes to the securityID branch. "nodeN" assignment to prevent printing. Alternative?
        node1   = h5file.createGroup("/"+nameString, "node1")
        table1  = h5file.createTable(node1, "node1Table", LeafClass1)
        node2   = h5file.createGroup("/"+nameString, "node2")
        table2  = h5file.createTable(node2, "node2Table", LeafClass2)
        node3   = h5file.createGroup("/"+nameString, "node3")
        table3  = h5file.createTable(node3, "node3Table", LeafClass3)
        node4   = h5file.createGroup("/"+nameString, "node4")
        table4  = h5file.createTable(node4, "node4Table", LeafClass4)
        node5   = h5file.createGroup("/"+nameString, "node5")
        table5  = h5file.createTable(node5, "node5Table", LeafClass5)
        node6   = h5file.createGroup("/"+nameString, "node6")
        table6  = h5file.createTable(node6, "node6Table", LeafClass6)
        node7   = h5file.createGroup("/"+nameString, "node7")
        table7  = h5file.createTable(node7, "node7Table", LeafClass7)
        node8   = h5file.createGroup("/"+nameString, "node8")  
        table8  = h5file.createTable(node8, "node8Table", LeafClass8)
        node9   = h5file.createGroup("/"+nameString, "node9")
        table9  = h5file.createTable(node9, "node9Table", LeafClass9)
    except:
        print ": Can't create a sub-node of " , nameString

def doit(nrGroups, nrRows):
    h5file = tables.openFile("testSegFault.h5", mode = "w")
    print "Making nodes..." 
    for i in xrange(1,nrGroups+1):
        name= "rootGroup_"+str(i)
        makeNodes(h5file, name)
        if divmod(i,1000)[1]==0:
            print "made",i, "nodes,"
#    print h5file
    print nrGroups, "made!\nNow making leaves..."
    for rower in xrange(1,nrRows):
        name = "rootGroup_"+str(random.randint(1,nrGroups))
        gp = str(random.randint(1,9))
        table = h5file.getNode("/"+name+"/node"+gp+"/node"+gp+"Table")
        table.row['L1'] = 1                                             # UInt8Col()
        table.row['L2'] = random.randint(0,36000)                       # UInt16Col()
        table.row['L3'] = random.randint(57600,86400)                   # UInt16Col()
        table.row['L4'] = random.randint(1,200000)                      # UInt32Col()
        table.row['L5'] = random.random()*100000000                     # Float32Col()
        table.row['L6'] = random.randint(1,100000000)                   # UInt16Col()
        table.row['L7'] = table.row['L4'] * table.row['L5']             # Float32Col()
        table.row['L8'] = random.randint(1,128) << random.randint(1,30) # UInt64Col()
        table.row['L9'] = "@#"+ str(random.randint(999,999999))         # StringCol(16)
        table.row.append()
        table.flush()
        if divmod(rower,1000)[1]==0:
            print "rows written:", rower
    print "Made!\nFinished writing",nrRows,"rows to 9 subgroups of" , nrGroups, "root groups.\nNow closing h5 file...",
    try:
        h5file.close()
        print "Closed!"
    except:
        print "Can't close h5 file."


doit(3000,100000)   # Makes 3000 nodes in root, each with nine sub-nodes. 100,000 leaves are then randomly attached.
                    # On OSX this SegFaults after 7000 leaves.



#h5=tables.openFile("testSegFault.h5")        



_________________________________________________
experimental polymedia: www.avatar.com.au
Sonic Communications Research Group,
University of Canberra:  creative.canberra.edu.au/scrg




-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to