nuodb / nuodb-python

Pure-python SQL driver implementation.
BSD 3-Clause "New" or "Revised" License
19 stars 19 forks source link

[DB-12019] cursor.close() - fails to clear the result set with error thrown with NuoDB version >=2.1 #119

Closed VDuda closed 9 years ago

VDuda commented 9 years ago

The driver does not close the ResultSet and with newer versions of nuodb (>=2.1) an OperationalError is thrown similar to:

...
    raise OperationalError(error_code_string + ': ' + error_string)
pynuodb.exception.OperationalError: 'INVALID_OPERATION: Maximum number of open statements (1000) exceeded'

Below is a code snippet that was used to generate the error.

import pynuodb

connection = pynuodb.connect("local", "localhost", "dba", "dba", options={'schema':'platform'})
for i in range(10000):
    cursor = connection.cursor()
    cursor.execute('select 1 from dual;')
    connection.commit()
    cursor.close()

I believe there was a regression introduced between 2.0.4 and 2.1 that changed the behavior with how we handled ResultSets.

mjmichaels commented 9 years ago

If this is a regression, how did it used to work?

VDuda commented 9 years ago

To be clear I believe the regression occurred in NuoDB core itself, between 2.0.4 and 2.1.

Within the python driver, before this commit, we were never sending a CloseResultSet message (id 28).