← Back to team overview

openerp-community-reviewer team mailing list archive

[Bug 1298258] Re: Log filled with "join and sleep" messages.

 

** Also affects: ocb-server
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of OpenERP
Community Backports Team, which is subscribed to OpenERP Community
Backports (Server).
https://bugs.launchpad.net/bugs/1298258

Title:
  Log filled with "join and sleep" messages.

Status in OpenERP Community Backports (Server):
  New
Status in OpenERP Server:
  New

Bug description:
  Sometimes when stopping the server some threads are not shutting down,
  and the log is filled with "join and sleep" messages that are sent
  every tenth of a second.

  The problematic part of the code is in openerp/service/__init__.py:

   97 def stop_services():                                                           
   98     """ Stop all services. """                                                 
   99     # stop services                                                            
  100     cron.stop_service()                                                        
  101     netrpc_server.stop_service()                                               
  102     wsgi_server.stop_service()                                                 
  103                                                                                
  104     _logger.info("Initiating shutdown")                                        
  105     _logger.info("Hit CTRL-C again or send a second signal to force the shutdown.")
  106                                                                                
  107     # Manually join() all threads before calling sys.exit() to allow a second signal
  108     # to trigger _force_quit() in case some non-daemon threads won't exit cleanly.
  109     # threading.Thread.join() should not mask signals (at least in python 2.5).
  110     me = threading.currentThread()                                             
  111     _logger.debug('current thread: %r', me)                                    
  112     for thread in threading.enumerate():                                       
  113         _logger.debug('process %r (%r)', thread, thread.isDaemon())            
  114         if thread != me and not thread.isDaemon() and thread.ident != main_thread_id:
  115             while thread.isAlive():                                            
  116                 _logger.debug('join and sleep')                                
  117                 # Need a busyloop here as thread.join() masks signals          
  118                 # and would prevent the forced shutdown.                       
  119                 thread.join(0.05)                                              
  120                 time.sleep(0.05)                                               
  121                                                                                
  122     _logger.debug('--')                                                        
  123     openerp.modules.registry.RegistryManager.delete_all()                      
  124     logging.shutdown()

  Apart from the problem that the server does not shut down properly,
  something should be done about the message volley fired into the log.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ocb-server/+bug/1298258/+subscriptions