mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 08:57:25 +01:00 
			
		
		
		
	control: log remaining threads on shutdown, for debugging freezes
This commit is contained in:
		
							parent
							
								
									95b58fc2c4
								
							
						
					
					
						commit
						e7a005b685
					
				@ -3,6 +3,7 @@ control.py - Implements SHUTDOWN and REHASH functionality.
 | 
			
		||||
"""
 | 
			
		||||
import signal
 | 
			
		||||
import os
 | 
			
		||||
import threading
 | 
			
		||||
 | 
			
		||||
from pylinkirc import world, utils, conf, classes
 | 
			
		||||
from pylinkirc.log import log, makeFileLogger, stopFileLoggers
 | 
			
		||||
@ -40,6 +41,10 @@ def _shutdown(irc=None):
 | 
			
		||||
    except OSError:
 | 
			
		||||
        log.exception("Failed to remove PID, ignoring...")
 | 
			
		||||
 | 
			
		||||
    log.info("Waiting for remaining threads to stop; this may take a few seconds. If PyLink freezes "
 | 
			
		||||
             "at this stage, press Ctrl-C to force a shutdown.")
 | 
			
		||||
    log.debug('_shutdown(): Remaining threads: %s', ['%s/%s' % (t.name, t.ident) for t in threading.enumerate()])
 | 
			
		||||
 | 
			
		||||
    # Done.
 | 
			
		||||
 | 
			
		||||
def sigterm_handler(signo, stack_frame):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user