KiteConnect frequently exiting with OpenSSL and FileNotFound error

Avi
Unhandled Error 0
Traceback (most recent call last):
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 96, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 80, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 117, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 82, in callWithContext
return func(*args, **kw)
--- ---
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/posixbase.py", line 683, in _doReadOrWrite
why = selectable.doRead()
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/tcp.py", line 248, in doRead
return self._dataReceived(data)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/tcp.py", line 253, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 330, in dataReceived
self._flushReceiveBIO()
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 301, in _flushReceiveBIO
self._flushSendBIO()
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 254, in _flushSendBIO
bytes = self._tlsConnection.bio_read(2 ** 15)
File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1945, in bio_read
self._handle_bio_errors(self._from_ssl, result)
File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1923, in _handle_bio_errors
_raise_current_error()
File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/_util.py", line 55, in exception_from_error_queue 4.59
raise exception_type(errors)
OpenSSL.SSL.Error: [] 0.00

Unhandled Error 0
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/base.py", line 1315, in run
self.mainLoop()
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/base.py", line 1328, in mainLoop
reactorBaseSelf.doIteration(t)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 244, in doPoll
log.callWithLogger(selectable, _drdw, selectable, fd, event)
--- ---
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 96, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 80, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 117, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 82, in callWithContext
return func(*args, **kw)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/posixbase.py", line 696, in _doReadOrWrite
self._disconnectSelectable(selectable, why, inRead)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/posixbase.py", line 302, in _disconnectSelectable
self.removeWriter(selectable)
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 189, in removeWriter
self._remove(
File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 167, in _remove 4.59
self._poller.unregister(fd)
builtins.FileNotFoundError: [Errno 2] No such file or directory 0.00

  • rakeshr
    OpenSSL.SSL.Error: [] 0.00
    Can you follow the steps here?
  • Avi
    I followed the steps, but still facing the same issue even after reinstall.
    I am not able to trade bcz of this issue. My client exits.
    Please see below the error I got just now:

    Unhandled Error
    Traceback (most recent call last):
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 96, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 80, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
    --- ---
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/posixbase.py", line 683, in _doReadOrWrite
    why = selectable.doRead()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/tcp.py", line 248, in doRead
    return self._dataReceived(data)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/tcp.py", line 253, in _dataReceived
    rval = self.protocol.dataReceived(data)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 330, in dataReceived
    self._flushReceiveBIO()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 301, in _flushReceiveBIO
    self._flushSendBIO()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 254, in _flushSendBIO
    bytes = self._tlsConnection.bio_read(2 ** 15)
    File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1945, in bio_read
    self._handle_bio_errors(self._from_ssl, result)
    File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1923, in _handle_bio_errors
    _raise_current_error()
    File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/_util.py", line 55, in exception_from_error_queue
    raise exception_type(errors)
    OpenSSL.SSL.Error: []

    Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Connection error: 1006 - connection was closed uncleanly (None)
    Connection closed: 1006 - connection was closed uncleanly (None)
    Unhandled Error
    Traceback (most recent call last):
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 96, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 80, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
    --- ---
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/posixbase.py", line 683, in _doReadOrWrite
    why = selectable.doRead()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/tcp.py", line 248, in doRead
    return self._dataReceived(data)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/tcp.py", line 253, in _dataReceived
    rval = self.protocol.dataReceived(data)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 330, in dataReceived
    self._flushReceiveBIO()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 301, in _flushReceiveBIO
    self._flushSendBIO()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 254, in _flushSendBIO
    bytes = self._tlsConnection.bio_read(2 ** 15)
    File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1945, in bio_read
    self._handle_bio_errors(self._from_ssl, result)
    File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/SSL.py", line 1923, in _handle_bio_errors
    _raise_current_error()
    File "/home/avinash/trading/lib/python3.8/site-packages/OpenSSL/_util.py", line 55, in exception_from_error_queue
    raise exception_type(errors)
    OpenSSL.SSL.Error: []

    Unhandled Error
    Traceback (most recent call last):
    File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/base.py", line 1315, in run
    self.mainLoop()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/base.py", line 1328, in mainLoop
    reactorBaseSelf.doIteration(t)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 244, in doPoll
    log.callWithLogger(selectable, _drdw, selectable, fd, event)
    --- ---
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 96, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/log.py", line 80, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/posixbase.py", line 696, in _doReadOrWrite
    self._disconnectSelectable(selectable, why, inRead)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/posixbase.py", line 302, in _disconnectSelectable
    self.removeWriter(selectable)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 189, in removeWriter
    self._remove(
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 167, in _remove
    self._poller.unregister(fd)
    builtins.FileNotFoundError: [Errno 2] No such file or directory

    Unhandled Error
    Traceback (most recent call last):
    File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
    File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/base.py", line 1315, in run
    self.mainLoop()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/base.py", line 1325, in mainLoop
    reactorBaseSelf.runUntilCurrent()
    --- ---
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/base.py", line 991, in runUntilCurrent
    call.func(*call.args, **call.kw)
    File "/home/avinash/trading/lib/python3.8/site-packages/kiteconnect/ticker.py", line 135, in _loop_pong_check
    self.dropConnection(abort=True)
    File "/home/avinash/trading/lib/python3.8/site-packages/autobahn/websocket/protocol.py", line 875, in dropConnection
    self._closeConnection(abort)
    File "/home/avinash/trading/lib/python3.8/site-packages/autobahn/twisted/websocket.py", line 295, in _closeConnection
    self.transport.abortConnection()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/protocols/tls.py", line 431, in abortConnection
    self.transport.abortConnection()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/tcp.py", line 199, in abortConnection
    self.stopWriting()
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/abstract.py", line 434, in stopWriting
    self.reactor.removeWriter(self)
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 189, in removeWriter
    self._remove(
    File "/home/avinash/trading/lib/python3.8/site-packages/twisted/internet/epollreactor.py", line 167, in _remove
    self._poller.unregister(fd)
    builtins.FileNotFoundError: [Errno 2] No such file or directory
  • rakeshr
    Can you update twisted and check once?
    pip install autobahn==22.7.1
  • Avi
    These are my versions:

    (trading) [email protected]:~/trading/scripts$ pip show kiteconnect
    Name: kiteconnect
    Version: 4.0.0
    Summary: The official Python client for the Kite Connect trading API
    Home-page: https://kite.trade
    Author: Zerodha Technology Pvt. Ltd. (India)
    Author-email: [email protected]
    License: MIT
    Location: /home/avinash/trading/lib/python3.8/site-packages
    Requires: pyOpenSSL, autobahn, service-identity, enum34, python-dateutil, requests, six
    Required-by:
    (trading) [email protected]:~/trading/scripts$ pip show pyOpenSSL
    Name: pyOpenSSL
    Version: 22.0.0
    Summary: Python wrapper module around the OpenSSL library
    Home-page: https://pyopenssl.org/
    Author: The pyOpenSSL developers
    Author-email: [email protected]
    License: Apache License, Version 2.0
    Location: /home/avinash/trading/lib/python3.8/site-packages
    Requires: cryptography
    Required-by: kiteconnect
    (trading) [email protected]:~/trading/scripts$ pip show autobahn
    Name: autobahn
    Version: 19.11.2
    Summary: WebSocket client & server library, WAMP real-time framework
    Home-page: http://crossbar.io/autobahn
    Author: Crossbar.io Technologies GmbH
    Author-email: None
    License: MIT License
    Location: /home/avinash/trading/lib/python3.8/site-packages
    Requires: six, txaio, cryptography
    Required-by: kiteconnect
    (trading) [email protected]:~/trading/scripts$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 20.04.5 LTS
    Release: 20.04
    Codename: focal
    (trading) [email protected]:~/trading/scripts$
  • Avi
    It is saying specified version s incompatible.
    ERROR: kiteconnect 4.0.0 has requirement autobahn[twisted]==19.11.2, but you'll have autobahn 22.7.1 which is incompatible.


    (trading) [email protected]:~/trading/scripts$ pip install autobahn==22.7.1
    Collecting autobahn==22.7.1
    Downloading autobahn-22.7.1.tar.gz (476 kB)
    |████████████████████████████████| 476 kB 5.2 MB/s
    Requirement already satisfied: txaio>=21.2.1 in /home/avinash/trading/lib/python3.8/site-packages (from autobahn==22.7.1) (22.2.1)
    Requirement already satisfied: cryptography>=3.4.6 in /home/avinash/trading/lib/python3.8/site-packages (from autobahn==22.7.1) (36.0.2)
    Requirement already satisfied: hyperlink>=21.0.0 in /home/avinash/trading/lib/python3.8/site-packages (from autobahn==22.7.1) (21.0.0)
    Requirement already satisfied: setuptools in /home/avinash/trading/lib/python3.8/site-packages (from autobahn==22.7.1) (59.6.0)
    Requirement already satisfied: cffi>=1.12 in /home/avinash/trading/lib/python3.8/site-packages (from cryptography>=3.4.6->autobahn==22.7.1) (1.15.0)
    Requirement already satisfied: idna>=2.5 in /home/avinash/trading/lib/python3.8/site-packages (from hyperlink>=21.0.0->autobahn==22.7.1) (3.3)
    Requirement already satisfied: pycparser in /home/avinash/trading/lib/python3.8/site-packages (from cffi>=1.12->cryptography>=3.4.6->autobahn==22.7.1) (2.21)
    Building wheels for collected packages: autobahn
    Building wheel for autobahn (setup.py) ... error
    ERROR: Command errored out with exit status 1:
    command: /home/avinash/trading/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-auew1r45/autobahn/setup.py'"'"'; __file__='"'"'/tmp/pip-install-auew1r45/autobahn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-el5y1una
    cwd: /tmp/pip-install-auew1r45/autobahn/
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
    or: setup.py --help [cmd1 cmd2 ...]
    or: setup.py --help-commands
    or: setup.py cmd --help

    error: invalid command 'bdist_wheel'
    ----------------------------------------
    ERROR: Failed building wheel for autobahn
    Running setup.py clean for autobahn
    Failed to build autobahn
    ERROR: kiteconnect 4.0.0 has requirement autobahn[twisted]==19.11.2, but you'll have autobahn 22.7.1 which is incompatible.
    Installing collected packages: autobahn
    Attempting uninstall: autobahn
    Found existing installation: autobahn 19.11.2
    Uninstalling autobahn-19.11.2:
    Successfully uninstalled autobahn-19.11.2
    Running setup.py install for autobahn ... done
    Successfully installed autobahn-22.7.1
  • Avi
    to resolve this, I upgraded my ubuntu from 20.04 to 22.04, kiteconnect from 4.0 to 4.1
    But still facing the same issue on fresh setup as well. Plz check below trace.

    Unhandled Error
    Traceback (most recent call last):
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/python/log.py", line 96, in callWithLogger
    return callWithContext({"system": lp}, func, *args, **kw)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/python/log.py", line 80, in callWithContext
    return context.call({ILogContext: newCtx}, func, *args, **kw)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
    --- ---
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/posixbase.py", line 683, in _doReadOrWrite
    why = selectable.doRead()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/tcp.py", line 248, in doRead
    return self._dataReceived(data)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/tcp.py", line 253, in _dataReceived
    rval = self.protocol.dataReceived(data)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/protocols/tls.py", line 330, in dataReceived
    self._flushReceiveBIO()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/protocols/tls.py", line 301, in _flushReceiveBIO
    self._flushSendBIO()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/protocols/tls.py", line 254, in _flushSendBIO
    bytes = self._tlsConnection.bio_read(2 ** 15)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/OpenSSL/SSL.py", line 1945, in bio_read
    self._handle_bio_errors(self._from_ssl, result)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/OpenSSL/SSL.py", line 1923, in _handle_bio_errors
    _raise_current_error()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/OpenSSL/_util.py", line 55, in exception_from_error_queue
    raise exception_type(errors)
    OpenSSL.SSL.Error: []

    Traceback (most recent call last):
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/kiteconnect/ticker.py", line 616, in set_mode
    Connection error: 1006 - connection was closed uncleanly (SSL error: unexpected eof while reading (in ))
    Connection closed: 1006 - connection was closed uncleanly (SSL error: unexpected eof while reading (in ))
    self.ws.sendMessage(
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 2266, in sendMessage
    self.sendFrame(opcode=opcode, payload=payload, sync=sync, rsv=4 if sendCompressed else 0)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 1880, in sendFrame
    self.sendData(raw, sync, chopsize)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 1336, in sendData
    self.transport.write(data)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/protocols/tls.py", line 460, in write
    self._write(bytes)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/protocols/tls.py", line 537, in _write
    self._flushSendBIO()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/protocols/tls.py", line 259, in _flushSendBIO
    self.transport.write(bytes)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/_newtls.py", line 179, in write
    FileDescriptor.write(self, bytes)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/abstract.py", line 363, in write
    self.startWriting()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/abstract.py", line 446, in startWriting
    self.reactor.addWriter(self)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/epollreactor.py", line 134, in addWriter
    self._add(
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/epollreactor.py", line 103, in _add
    self._poller.modify(fd, flags)
    FileNotFoundError: [Errno 2] No such file or directory
  • rakeshr
    Then, it looks DNS issue at your end. Also, are you using any kind of VPN or proxy?
    Can you change the network and check once?
  • Avi
    I am using BSNL broadband service and there is no VPN or proxy in between.
    I will try once on airtel 4G and let u know.
  • Avi
    Same issue observed on Airtel 4G as well.

    Connection error: 1006 - connection was closed uncleanly (None)
    Connection closed: 1006 - connection was closed uncleanly (None)
    Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Connection error: 1006 - connection was closed uncleanly (None)
    Connection closed: 1006 - connection was closed uncleanly (None)
    Connection error: 1006 - connection was closed uncleanly (None)
    Connection closed: 1006 - connection was closed uncleanly (None)
    Connection error: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Connection closed: 1006 - connection was closed uncleanly (peer dropped the TCP connection without previous WebSocket closing handshake)
    Unhandled Error
    Traceback (most recent call last):
    File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
    self.run()
    File "/usr/lib/python3.10/threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/base.py", line 1315, in run
    self.mainLoop()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/base.py", line 1325, in mainLoop
    reactorBaseSelf.runUntilCurrent()
    --- ---
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/base.py", line 991, in runUntilCurrent
    call.func(*call.args, **call.kw)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/kiteconnect/ticker.py", line 136, in _loop_pong_check
    self.dropConnection(abort=True)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/autobahn/websocket/protocol.py", line 875, in dropConnection
    self._closeConnection(abort)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/autobahn/twisted/websocket.py", line 295, in _closeConnection
    self.transport.abortConnection()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/protocols/tls.py", line 431, in abortConnection
    self.transport.abortConnection()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/tcp.py", line 199, in abortConnection
    self.stopWriting()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/abstract.py", line 434, in stopWriting
    self.reactor.removeWriter(self)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/epollreactor.py", line 189, in removeWriter
    self._remove(
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/epollreactor.py", line 168, in _remove
    self._poller.unregister(fd)
    builtins.FileNotFoundError: [Errno 2] No such file or directory

    Unhandled Error
    Traceback (most recent call last):
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/base.py", line 498, in fireEvent
    DeferredList(beforeResults).addCallback(self._continueFiring)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/defer.py", line 497, in addCallback
    return self.addCallbacks(callback, callbackArgs=args, callbackKeywords=kwargs)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/defer.py", line 477, in addCallbacks
    self._runCallbacks()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/defer.py", line 857, in _runCallbacks
    current.result = callback( # type: ignore[misc]
    --- ---
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/base.py", line 510, in _continueFiring
    callable(*args, **kwargs)
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/base.py", line 760, in disconnectAll
    selectables = self.removeAll()
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/epollreactor.py", line 200, in removeAll
    [self._selectables[fd] for fd in self._writes],
    File "/home/avinash/trading-ubuntu22/lib/python3.10/site-packages/twisted/internet/epollreactor.py", line 200, in
    [self._selectables[fd] for fd in self._writes],
    builtins.KeyError: 228
  • Avi
    Avi edited September 2
    Please look into this as I am not able to trade.
  • rakeshr
    Are other API endpoints working? Like order placement, order book fetches, etc.
  • Avi
    Yes Sir. All APIs are working. The problem is: it exits in between and I loose all tick data.
    I need to restart my client everytime this error occurs.
Sign In or Register to comment.