def _cleanup_port(self):
        """Clean up the port before starting."""
        if not self._is_port_in_use():
            return True
            
        # Try to kill processes using the port
        self._kill_process_using_port()
        time.sleep(0.2)  # Reduced sleep time
        
        # If port is still in use, try one more aggressive approach
        if self._is_port_in_use():
            try:
                # Try to bind to the port to force it free
                sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
                sock.bind((self.host, self.port))
                sock.close()
            except socket.error:
                # If binding fails, try one more kill attempt
                for proc in psutil.process_iter(['pid']):
                    try:
                        process = psutil.Process(proc.info['pid'])
                        if any(len(conn.laddr) >= 2 and conn.laddr[1] == self.port 
                              for conn in process.net_connections(kind='inet')):
                            process.kill()
                    except Exception:
                        continue
                time.sleep(0.2)  # Reduced sleep time
        
        return not self._is_port_in_use()
Clean up the port before starting.
src/upsonic/server_manager.py