Avoinding file handle leak using the Python bindings & core.Stream
From: Willmer, Alex (PTS) <al.willmer_at_logica.com>
Date: Mon, 16 Apr 2012 09:29:19 +0000
I've been working on an full text search plugin for Trac. At initial setup this indexes the entire Subversion repository by reading every node of every version. During testing we discovered that the indexer was running out of file handles, due to a file handle leak. As far as I can tell each core.Stream(fs.file_contents(.)) instance that was created and not subsequently .read() left an unclosed file handle. To work around this I have monkey patched a Stream.close() method that calls svn_stream_close, which is used in a try/finally block.
The work-around has fixed our file-handle leak for, but I believe it points to a bug in the Subversion bindings for which I'll try and provide a patch. Before I file a bug I'd like to check I haven't misunderstood anything:
-- Alex Willmer | Developer 2 Trinity Park, Birmingham, B37 7ES | United Kingdom M: +44 7557 752744 al.willmer_at_logica.com | www.logica.com Logica UK Ltd, registered in UK (registered number 947968) Registered Office: 250 Brook Drive, Green Park, Reading RG2 6UA, United Kingdom Think green - keep it on the screen. This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.Received on 2012-04-16 11:38:28 CEST
This is an archived mail posted to the Subversion Users mailing list.