# Buggy code
def stop(self):
    return self._node.safe_stop_looping_call(self._process_lc)


# Traceback (ValueError)
2018-09-17 05:43:51,637 INFO     lbrynet.reflector.client.client:74: Reflector has all blobs for b41893e22fa11414
2018-09-17 05:43:51,641 INFO     lbrynet.reflector.client.client:77: No more completed blobs for ee2b8996e30e9f6b to reflect, 120 are still needed
2018-09-17 05:43:51,675 INFO     lbrynet.reflector.client.client:77: No more completed blobs for ee7458aa0b1fb469 to reflect, 1 are still needed
2018-09-17 05:52:25,446 ERROR    lbrynet.dht.protocol:444: error handling request for 122.162.66.158:4444 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 05:53:05,716 ERROR    lbrynet.dht.protocol:444: error handling request for 122.162.66.158:4444 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 05:54:25,549 ERROR    lbrynet.dht.protocol:444: error handling request for 122.162.66.158:4444 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 05:54:46,935 ERROR    lbrynet.dht.protocol:444: error handling request for 122.162.66.158:4444 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:21,377 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:21,613 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:21,614 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:22,794 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:22,796 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:22,797 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:24,004 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:24,006 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:24,007 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:24,062 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:24,071 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,194 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,195 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,196 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,430 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,431 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,486 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,488 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,547 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:25,549 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:26,024 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:4445 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:26,025 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:26,027 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:26,262 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:26,263 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:27,136 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53833 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:27:27,138 ERROR    lbrynet.dht.protocol:444: error handling request for 85.17.24.157:53835 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:37:25,263 ERROR    lbrynet.dht.protocol:444: error handling request for 188.24.157.138:1029 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:37:27,106 ERROR    lbrynet.dht.protocol:444: error handling request for 188.24.157.138:1029 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
2018-09-17 06:37:55,473 ERROR    lbrynet.dht.protocol:444: error handling request for 188.24.157.138:1029 b'store'
Traceback (most recent call last):
File "lbrynet\dht\protocol.py", line 440, in _handleRPC
File "lbrynet\dht\node.py", line 509, in store
ValueError: Invalid token
Unhandled error in Deferred:
2018-09-17 06:39:55,637 CRITICAL twisted:154: Unhandled error in Deferred:

Fatal Python error: Cannot recover from stack overflow.

Thread 0x00008c88 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x000026e4 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00001b8c (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00002a0c (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00005acc (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x0000bd54 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00006508 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00002720 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00006c60 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x000026ec (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x000057c0 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00006b68 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Thread 0x00008318 (most recent call first):
File "threading.py", line 295 in wait
File "queue.py", line 164 in get
File "twisted\_threads\_threadworker.py", line 45 in work
File "threading.py", line 864 in run
File "threading.py", line 916 in _bootstrap_inner
File "threading.py", line 884 in _bootstrap

Current thread 0x000027e4 (most recent call first):
File "c:\Python36\lib\traceback.py", line 352 in extract
File "c:\Python36\lib\traceback.py", line 497 in __init__
File "c:\Python36\lib\traceback.py", line 486 in __init__
File "c:\Python36\lib\traceback.py", line 486 in __init__
File "c:\Python36\lib\traceback.py", line 100 in print_exception
File "logging\__init__.py", line 533 in formatException
File "logging\__init__.py", line 583 in format
File "logging\__init__.py", line 838 in format
File "logging\handlers.py", line 187 in shouldRollover
File "logging\handlers.py", line 71 in emit
File "logging\__init__.py", line 863 in handle
File "logging\__init__.py", line 1514 in callHandlers
File "logging\__init__.py", line 1452 in handle
File "logging\__init__.py", line 1442 in _log
File "logging\__init__.py", line 1372 in log
File "twisted\logger\_stdlib.py", line 116 in __call__
File "twisted\logger\_legacy.py", line 154 in publishToNewObserver
File "twisted\python\log.py", line 595 in emit
File "twisted\logger\_legacy.py", line 93 in __call__
File "twisted\logger\_observer.py", line 131 in __call__
File "twisted\logger\_logger.py", line 144 in emit
File "twisted\logger\_logger.py", line 190 in failure
File "twisted\internet\defer.py", line 964 in __del__
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 311 in addCallbacks
File "twisted\internet\defer.py", line 345 in addBoth
File "twisted\internet\defer.py", line 1653 in execute
File "twisted\internet\defer.py", line 654 in _runCallbacks
File "twisted\internet\defer.py", line 568 in _startRunCallbacks
File "twisted\internet\defer.py", line 460 in callback
File "twisted\internet\defer.py", line 1797 in release
File "twisted\internet\defer.py", line 1625 in _releaseAndReturn
File "twisted\internet\defer.py", line 654 in _runCallbacks
...

# Fixed code
def stop(self):
    map(
        None,
        (
            cancel()
            for _, (call, cancel) in self._enqueued_contacts.items()
            if not call.called
        ),
    )
    return self._node.safe_stop_looping_call(self._process_lc)