Hello, I have lost many hours trying to debug a weird issue with unit tests and SQLite where two completely remote tests influenced each other. One of them would hang when the test is enabled. I couldn't make sense of the result because it was too unlogical.
To fix this strange side effect I had to explicitly call "closeCursor()" on the prepared statements of my new code. I know that in many places in the code we rely on garbage collection to trigger cursor closing, but it doesn't seem to be enough. In my case I think the issue is due to the fact that I stored the prepared statement as a class attribute, and maybe that class isn't garbage collected early enough so the prepared statement isn't collected and cursors stay open for too long... at least when running unit tests. Ref https://github.com/owncloud/core/pull/7539/files#diff-07a5cf597a8775f7351a9bbaa5eb5084R14 Furthermore there were recently reports of file handles not freed properly because in some places files weren't explicitly closed with fclose(). So from now on I suggest to follow these rules: - always explicitly close cursors with statement->closeCursor() after fetching results - always explicitly close files with fclose() This will certainly save future headaches with unexplicable side-effects. Thank you, Vincent _______________________________________________ Devel mailing list [email protected] http://mailman.owncloud.org/mailman/listinfo/devel
