exxeleron / qPython

interprocess communication between Python and kdb+
http://www.devnet.de
Apache License 2.0
152 stars 89 forks source link

Fatal socket timeout with any sync/async call #11

Closed maciejlach closed 9 years ago

maciejlach commented 9 years ago

On behalf of David Roberts as reported in https://groups.google.com/forum/#!topic/exxeleron/yDTruQw8wvw

qwriter does not flush buffers resulting in any sync or async query being able to stall.

Line 80 in qwriter needs to be sendall, not send or python does not dispatch the whole buffer and flush.

To reproduce, run on a linux server with default network buffers a few ms distant from the server - windows socket stack doesn't seem to exhibit the same behaviour:

def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
    return ''.join(random.choice(chars) for _ in range(size))

text=[]

for a in range(1000):
    text.append(id_generator(100))

q = qconnection.QConnection()
q.open()
print q("1b")
print q.sync("{count x}",qlist(range(100000), qtype=qtype.QINT_LIST))
print q.sync("{count x}",qlist(text, qtype=qtype.QSYMBOL_LIST))
print q("1b")