Ticker connect errored out and did not reconnect

santhanakrishnan25
Got the below error in zerodha ticker:
ubuntu@ip-172-31-45-215:~/ssk/algo/logs$ grep -ni sslv3 app.log
6569:2023-01-19 09:18:57,801 - ERROR - Connection error: 1006 - connection was closed uncleanly (SSL error: sslv3 alert bad record mac (in )) - 662 of ticker.py
6570:2023-01-19 09:18:57,801 - ERROR - Ticker errored out. code = 1006, reason = connection was closed uncleanly (SSL error: sslv3 alert bad record mac (in )) - 44
6571:2023-01-19 09:18:57,801 - ERROR - Connection closed: 1006 - connection was closed uncleanly (SSL error: sslv3 alert bad record mac (in )) - 655 of ticker.py
6572:2023-01-19 09:18:57,801 - ERROR - Ticker got disconnected. code = 1006, reason = connection was closed uncleanly (SSL error: sslv3 alert bad record mac (in )) - 41
Code base:
ticker.on_connect = self.on_connect
ticker.on_close = self.on_close
ticker.on_error = self.on_error
ticker.on_reconnect = self.on_reconnect
ticker.on_noreconnect = self.on_noreconnect
ticker.on_ticks = self.on_ticks
ticker.on_order_update = self.on_order_update

logging.info('ZerodhaTicker: Going to connect..')
self.ticker = ticker
self.ticker.connect(threaded=True)

Our system caught the below exception and got stuck. Could not trace which API raised this in first place, to catch the exception. Please help!!
Unhandled error in Deferred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/twisted/internet/_resolver.py", line 155, in deliverResults
resolutionReceiver.addressResolved(
File "/usr/lib/python3/dist-packages/twisted/internet/_resolver.py", line 269, in addressResolved
self._deferred.callback(address.host)
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 661, in callback
self._startRunCallbacks(result)
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 763, in _startRunCallbacks
self._runCallbacks()
--- ---
File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 857, in _runCallbacks
current.result = callback( # type: ignore[misc]
File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 466, in _setRealAddress
self.doConnect()
File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 598, in doConnect
self.startReading()
File "/usr/lib/python3/dist-packages/twisted/internet/abstract.py", line 438, in startReading
self.reactor.addReader(self)
File "/usr/lib/python3/dist-packages/twisted/internet/epollreactor.py", line 117, in addReader
self._add(
File "/usr/lib/python3/dist-packages/twisted/internet/epollreactor.py", line 103, in _add
self._poller.modify(fd, flags)
builtins.FileNotFoundError: [Errno 2] No such file or directory

Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1315, in run
self.mainLoop()
File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 1325, in mainLoop
reactorBaseSelf.runUntilCurrent()
--- ---
File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 991, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 477, in failIfNotConnected
self._stopReadingAndWriting()
File "/usr/lib/python3/dist-packages/twisted/internet/tcp.py", line 541, in _stopReadingAndWriting
self.stopWriting()
File "/usr/lib/python3/dist-packages/twisted/internet/abstract.py", line 434, in stopWriting
self.reactor.removeWriter(self)
File "/usr/lib/python3/dist-packages/twisted/internet/epollreactor.py", line 189, in removeWriter
self._remove(
File "/usr/lib/python3/dist-packages/twisted/internet/epollreactor.py", line 168, in _remove
self._poller.unregister(fd)
builtins.FileNotFoundError: [Errno 2] No such file or directory
Tagged:
  • santhanakrishnan25
    Should i use disable_ssl_verification=True?
  • rakeshr
    (SSL error: sslv3 alert bad record mac (in )) - 655 of ticker.py
    Looks like your other thread created is closing the main connection in multi-threading. Maybe you can check at line no:655 of your file(ticker.py) and inspect further.
Sign In or Register to comment.