Exemple #1
0
	def _mod_died( self, pid, status, module_name ):
		if status:
			if os.WIFSIGNALED( status ):
				signal = os.WTERMSIG( status )
				exitcode = -1
			elif os.WIFEXITED( status ):
				signal = -1
				exitcode = os.WEXITSTATUS( status )
			else:
				signal = -1
				exitcode = -1
			CORE.warn( 'Module process %s died (pid: %d, exit status: %d, signal: %d)' % ( module_name, pid, exitcode, signal ) )
		else:
			CORE.info( 'Module process %s died on purpose' % module_name )

		# if killtimer has been set then remove it
		CORE.info( 'Checking for kill timer (%s)' % ', '.join( self.__killtimer.keys() ) )
		if module_name in self.__killtimer:
			CORE.info( 'Stopping kill timer)' )
			notifier.timer_remove( self.__killtimer[ module_name ] )
			del self.__killtimer[ module_name ]
		if module_name in self.__processes:
			CORE.warn( 'Cleaning up requests' )
			self.__processes[ module_name ].invalidate_all_requests()
			if self.__processes[ module_name ]._inactivity_timer is not None:
				CORE.warn( 'Remove inactivity timer' )
				notifier.timer_remove( self.__processes[ module_name ]._inactivity_timer )
			del self.__processes[ module_name ]
	def _mod_died(self, pid, status, module_name):
		if status:
			if os.WIFSIGNALED(status):
				signal = os.WTERMSIG(status)
				exitcode = -1
			elif os.WIFEXITED(status):
				signal = -1
				exitcode = os.WEXITSTATUS(status)
			else:
				signal = -1
				exitcode = -1
			CORE.warn('Module process %s died (pid: %d, exit status: %d, signal: %d, status: %r)' % (module_name, pid, exitcode, signal, status))
		else:
			CORE.info('Module process %s died on purpose' % module_name)

		# if killtimer has been set then remove it
		CORE.info('Checking for kill timer (%s)' % ', '.join(self.__killtimer.keys()))
		if module_name in self.__killtimer:
			CORE.info('Stopping kill timer)')
			notifier.timer_remove(self.__killtimer[module_name])
			del self.__killtimer[module_name]
		if module_name in self.__processes:
			CORE.warn('Cleaning up requests')
			self.__processes[module_name].invalidate_all_requests(status=SERVER_ERR_MODULE_DIED)
			if self.__processes[module_name]._inactivity_timer is not None:
				CORE.warn('Remove inactivity timer')
				notifier.timer_remove(self.__processes[module_name]._inactivity_timer)
			del self.__processes[module_name]
Exemple #3
0
			def process_IN_MODIFY(self, event):
				if self.running:
					# remove running timer
					notifier.timer_remove(self.running)
				# add a timer which reloads UCR Variables in 10 seconds
				self.running = notifier.timer_add( 10000, self.process )
				return True
Exemple #4
0
	def stop(self):
		CORE.process('ModuleProcess: stopping %r' % (self.__pid,))
		notifier.timer_remove(self._connect_timer)
		if self.__process:
			self.disconnect()
			self.__process.signal_disconnect('killed', self._died)
			self.__process.stop()
			self.__process = None
			CORE.info('ModuleProcess: child stopped')
Exemple #5
0
	def shutdown(self):
		"""Instructs the module process to shutdown"""
		if self.__processes:
			CORE.info('The session is shutting down. Sending EXIT request to %d modules.' % len(self.__processes))

		for module_name in list(self.__processes.keys()):
			CORE.info('Ask module %s to shutdown gracefully' % (module_name,))
			req = Request('EXIT', arguments=[module_name, 'internal'])
			process = self.__processes.pop(module_name)
			process.request(req)
			notifier.timer_remove(process._connect_timer)
			notifier.timer_add(4000, process.stop)

		if self._user_connections:
			reset_ldap_connection_cache(*self._user_connections)

		if isinstance(self.acls, LDAP_ACLs):
			reset_ldap_connection_cache(self.acls.lo)
			self.acls = None
Exemple #6
0
 def stop(self):
     if self._timer is not None:
         notifier.timer_remove(self._timer)
         self._timer = None
 def reset_connection_timeout(self, state):
     state.reset_connection_timeout()
     notifier.timer_remove(state._timer)
     state._timer = notifier.timer_add(
         state.timeout * 1000, notifier.Callback(self._timed_out, state))