Unexpected EOF on client connection with an open transaction
<p>I want to using threading to connect postgresql
but postgresql log show：</p>

<blockquote>
  <p>unexpected EOF on client connection with an open transaction</p>
</blockquote>

<p>here is my code：</p>

<pre><code>conn = []
for i in range(10):
    conn.append(psycopg2.connect("dbname=test user=higis password=dbrgdbrg host=10.1.1.215 port=5432"))
print conn
def test_query(a,b,c,d,name,i):
    try:
        #conn = psycopg2.connect("dbname=test user=higis password=dbrgdbrg host=10.1.1.215 port=5432")
        cur = conn[i].cursor()
        sql_query = "SELECT count(*) FROM " + str(name) + " WHERE ST_MAKEENVELOPE" + str(
            (a, b, c, d, 4326)) + "&amp;&amp; wkb_geometry"
        start = time.time()
        cur.execute(sql_query)
        #conn.commit()
        end = time.time()
        results_time = end - start
        results = cur.fetchall()
        cur.close()
        conn[i].close()
        #print results
        #print  results[0][0]
        suit_f = open("/home/pj/Desktop/test/log/replicate_query_time.txt", 'a')
        print &gt;&gt; suit_f, (
            'range query table:,%s,(%s %s %s %s),%s,%s' % (name, a, b, c, d, results[0][0], results_time))
    except Exception, e:
        print e

a_all = [1，2，3，4，5，6，7，8，9，10]
b_all = [1，2，3，4，5，6，7，8，9，10]
c_all = [1，2，3，4，5，6，7，8，9，10]
d_all = [1，2，3，4，5，6，7，8，9，10]
threads = []
for i in range(10):
    a = a_all[i]
    b = b_all[i]
    c = c_all[i]
    d = d_all[i]
    t = threading.Thread(target=test_query,args=(a,b,c,d,"replicate_table1",i))
    threads.append(t)

if __name__ == '__main__':
    i = 0
    for t in threads:
        print "Thread:" + str(i) + " t and the time = %s" %(ctime())
        t.setDaemon(True)
        t.start()
        i = i+1
    t.join()
    #conn.commit()
</code></pre>