CLOSE REASON WITHOUT CLOSE CODE

deadlock
I am using KiteTicker in threaded mode and I am consistently getting the above error. The above runtime error occurs in the main thread at the last line, namely, kt.set_mode(kt.MODE_FULL, tokens). I need to use kt.MODE_FULL only and I need all ticks.

Code snippet where error occurs (see last line):
kt.connect(threaded=True)
tokens = [13299458]
while True:
if kt.is_connected():
kt.set_mode(kt.MODE_FULL, tokens) => ERROR: CLOSE REASON WITHOUT CLOSE CODE

Entire code of main.py (for reference):
from kiteconnect import KiteTicker
import logging

def onconnect(ws, response):
tokens = [13299458]
ws.subscribe(tokens)
ws.set_mode(ws.MODE_FULL, tokens)

def onticks(ws, ticks):
logging.info("Ticks: {}".format(ticks))

logging.basicConfig(level=logging.DEBUG)
kt = KiteTicker(api_key='***', access_token='***')

# Callback when current connection is closed.
def onclose(ws, code, reason):
logging.info("Connection closed: {code} - {reason}".format(code=code, reason=reason))

# Callback when connection closed with error.
def onerror(ws, code, reason):
logging.info("Connection error: {code} - {reason}".format(code=code, reason=reason))

# Callback when reconnect is on progress
def onreconnect(ws, attempts_count):
logging.info("Reconnecting: {}".format(attempts_count))

# Callback when all reconnect failed (exhausted max retries)
def onnoreconnect(ws):
logging.info("Reconnect failed.")

# Assign the callbacks.
kt.on_ticks = onticks
kt.on_connect = onconnect
kt.on_close = onclose
kt.on_error = onerror
kt.on_reconnect = onreconnect
kt.on_noreconnect = onnoreconnect

#kt.connect()
kt.connect(threaded=True)

tokens = [13299458]
while True:
if kt.is_connected():
kt.set_mode(kt.MODE_FULL, tokens)

Version Details:
1. Kite Connect API version: 4.1.0
2. Python version: 3.10.7
3. Windows version: Windows 10

This discussion has been closed.