Skip to content

EMFILE, possible file handler leak #1636

@tlhunter

Description

@tlhunter

Bug Description
When running local builds over and over (bundle exec middleman build), I eventually get an EMFILE error. I can temporarily fix this by closing VS Code and dev servers that watch the filesystem for changes before rebuilding. However, even with them closed, I'll eventually get the error again after compiling several times. This makes me think each time a compilation happens that there are still filesystem handlers left open.

Screenshots

== Sprockets will render css with ruby sass                                                                                                                                                                                                                                    
   consider using Sprockets 4.x to render with SassC                                                                                                                                                                                                                           
Traceback (most recent call last):                                                                                                                                                                                                                                             
        59: from /usr/local/bin/middleman:23:in `<main>'                                                                                                                                                                                                                       
        58: from /usr/local/bin/middleman:23:in `load'                                                                             
        57: from /var/lib/gems/2.7.0/gems/middleman-cli-4.4.2/bin/middleman:70:in `<top (required)>'                               
        56: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'                                               
        55: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'                                                 
        54: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'                                
        53: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'                                               
        52: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:40:in `block in register'                                         
        51: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:116:in `invoke'                                        
        50: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/group.rb:232:in `dispatch'                                           
        49: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `invoke_all'                                    
        48: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `map'                                           
        47: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `each'                                          
        46: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `block in invoke_all'                           
        45: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'                                
        44: from /var/lib/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'                                               
        43: from /var/lib/gems/2.7.0/gems/middleman-cli-4.4.2/lib/middleman-cli/build.rb:66:in `build'                             
        42: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/util.rb:21:in `instrument'                       
        41: from /var/lib/gems/2.7.0/gems/activesupport-6.1.4.1/lib/active_support/notifications.rb:205:in `instrument'            
        40: from /var/lib/gems/2.7.0/gems/middleman-cli-4.4.2/lib/middleman-cli/build.rb:67:in `block in build'                    
        39: from /var/lib/gems/2.7.0/gems/middleman-cli-4.4.2/lib/middleman-cli/build.rb:67:in `new'                               
        38: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/application.rb:306:in `initialize'               
        37: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/callback_manager.rb:28:in `block in install_methods!'
        36: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'       
        35: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'                            
        34: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'                       
        33: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/callback_manager.rb:57:in `execute'              
        32: from /var/lib/gems/2.7.0/gems/hamster-3.0.0/lib/hamster/vector.rb:431:in `each'                                        
        31: from /var/lib/gems/2.7.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `traverse_depth_first'                           
        30: from /var/lib/gems/2.7.0/gems/hamster-3.0.0/lib/hamster/vector.rb:1316:in `each'                                           
        29: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/callback_manager.rb:57:in `block in execute'         
        28: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/callback_manager.rb:57:in `instance_exec'            
        27: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/extension.rb:405:in `block in bind_after_configuration'
        26: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'           
        25: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'                                
        24: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'                           
        23: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/core_extensions/file_watcher.rb:66:in `after_configuration'
        22: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'           
        21: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'                                
        20: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'                           
        19: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/sources.rb:249:in `start!'                           
        18: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/sources.rb:249:in `each'                             
        17: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'           
        16: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'                                
        15: from /var/lib/gems/2.7.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'                           
        14: from /var/lib/gems/2.7.0/gems/middleman-core-4.4.2/lib/middleman-core/sources/source_watcher.rb:182:in `listen!'           
        13: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/listener.rb:90:in `start'                                            
        12: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/fsm.rb:57:in `transition'                                            
        11: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/fsm.rb:91:in `transition_with_callbacks!'                            
        10: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `call'                                                 
         9: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `instance_eval'                                        
         8: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/listener.rb:67:in `block in <class:Listener>'                        
         7: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/backend.rb:28:in `start'                                             
         6: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:63:in `start'                                        
         5: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `configure'                                    
         4: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `each'                                         
         3: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/adapter/base.rb:45:in `block in configure'                           
         2: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/adapter/linux.rb:31:in `_configure'                                  
         1: from /var/lib/gems/2.7.0/gems/listen-3.0.8/lib/listen/adapter/linux.rb:31:in `new'                                         
/var/lib/gems/2.7.0/gems/rb-inotify-0.10.1/lib/rb-inotify/notifier.rb:69:in `initialize': Too many open files - Failed to initialize inotify: the user limit on the total number of inotify instances has been reached. (Errno::EMFILE)

Browser (please complete the following information):

  • OS: Linux foo 5.15.23-051523-generic #202202110435 SMP Fri Feb 11 09:38:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • Browser N/A
  • Version Slate 2.13.0

Last upstream Slate commit:
848d9ee

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions