Edgewall Software

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11139 closed defect (cantfix)

OSError Too many open files when log_file = file

Reported by: ryanc@… Owned by:
Priority: normal Milestone:
Component: general Version: 0.12.4
Severity: normal Keywords:
Cc: steam@… Branch:
Release Notes:
API Changes:
Internal Changes:


My Trac instances have recently been displaying 500 errors to users intermittently, the exceptions being logged are "OSError: [Errno 24] Too many open files".

Even after I greatly raised the open files limit for all users to an absurd value (999999) these exceptions persisted. The max open file limit for the entire system is 327756 though I've never seen lsof return more than 30k lines or so.

The only aberrant thing I've noticed in lsof output is that by far my various Trac instances' log files are the files that appear most frequently, each being listed in 2-3k lines of lsof output.

No matter what I do to the system, after Apache has been running for a certain amount of time these errors begin to manifest themselves.

I've done a fair amount of experimenting to try and narrow down the problem. While Googling I found #8899 which describes similar symptoms to mine on a Windows box. I was able to stop the errors and exceptions by setting log_file = none for all my Trac instances.

I still have a certain amount of logging for other exceptions and errors in my Apache logs but disabling Trac's internal logging facility altogether is not an ideal solution for me.

System details

  • Linux OpenVZ VM
  • CentOS 6.4
  • Python 2.6.6 (python-2.6.6-36.el6.x86_64)
  • Apache/2.2.15 (httpd-2.2.15-26.el6.centos.x86_64)
  • mod_wsgi/3.3 (WSGIProcessGroup trac WSGIApplicationGroup %{GLOBAL})
  • Trac 0.12.4dev-r11051
  • 8 Trac instances
  • Individual Trac instances have log_file set to log_file = trac.log

Example exception

The modules and directories indicated in the exceptions aren't always the same

2013-03-22 18:27:06,167 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/Trac-0.12.4dev_r11051-py2.6.egg/trac/web/main.py", line 522, in _dispatch_request
  File "/usr/lib/python2.6/site-packages/Trac-0.12.4dev_r11051-py2.6.egg/trac/web/main.py", line 264, in dispatch
  File "/usr/lib/python2.6/site-packages/Trac-0.12.4dev_r11051-py2.6.egg/trac/web/chrome.py", line 843, in render_template
  File "/usr/lib/python2.6/site-packages/genshi/core.py", line 132, in __or__
  File "/usr/lib/python2.6/site-packages/Trac-0.12.4dev_r11051-py2.6.egg/trac/web/chrome.py", line 999, in inner
  File "/usr/lib/python2.6/site-packages/TicketSidebarProvider-0.0_r10457-py2.6.egg/ticketsidebarprovider/ticketsidebar.py", line 44, in filter_stream
  File "/usr/lib/python2.6/site-packages/TicketMoverPlugin-0.1.1-py2.6.egg/ticketmoverplugin/web_ui.py", line 28, in enabled
  File "/usr/lib/python2.6/site-packages/TicketMoverPlugin-0.1.1-py2.6.egg/ticketmoverplugin/ticketmover.py", line 155, in projects
OSError: [Errno 24] Too many open files: '/opt/trac'

Attachments (0)

Change History (2)

comment:1 by steam@…, 10 years ago

Cc: steam@… added

comment:2 by Jun Omae, 10 years ago

Resolution: cantfix
Status: newclosed

PluginIssue (th:TicketMoverPlugin). The issue is caused by incorrect use of open_environment. Please report to the maintainers of the plugin.

  • ticketmoverplugin/ticketmover.py

    155155        for project in _projects:
    156156            path = os.path.join(base_path, project)
    157157            try:
    158                 env = open_environment(path)
     158                env = open_environment(path, use_cache=True)
    159159            except:
    160160                continue
    161161            perm = PermissionSystem(env)
    176176        # open the environment if it is a string
    177177        if isinstance(env, basestring):
    178178            base_path, _project = os.path.split(self.env.path)
    179             env = open_environment(os.path.join(base_path, env))
     179            env = open_environment(os.path.join(base_path, env), use_cache=True)
    181181        # get the old ticket
    182182        old_ticket = Ticket(self.env, ticket_id)
Last edited 10 years ago by Jun Omae (previous) (diff)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.