Trac API nezavírá souborovou konexi
I have written some Python script using Trac API for handling tickets in this bug system. Unfortunately after some time running, it failed with error: IOError: [Errno 24] Too many open files.
I was checking my code and everything was OK. So I downloaded excellent tool called “Process Explorer“. In this program, you can watch any process.
In menu: View -> Lowe pane view -> Handles you can view all open handles by your program. There I found out, that there is bug in Trac, which is not closing the file handle of log file even when shutdown() function is called.
To fix it, it is necessary next to calling env.shutdown() also call this code:
if hasattr(env.log, '_trac_handler'): hdlr = env.log._trac_handler env.log.removeHandler(hdlr) hdlr.close()