{"id":"3d14617a8b6027dd","repo":"pika/pika","slug":"ioloop-is-not-reentrant-and-is-already-running","errorCode":null,"errorMessage":"IOLoop is not reentrant and is already running","messagePattern":"IOLoop is not reentrant and is already running","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"pika/adapters/select_connection.py","lineNumber":851,"sourceCode":"\n        for fileno, events in fd_to_events.items():\n            self._register_fd(fileno, events)\n\n    def deactivate_poller(self) -> None:\n        \"\"\"Deactivate the poller.\"\"\"\n        self._uninit_poller()\n\n    def start(self) -> None:\n        \"\"\"\n        Start the main poller loop.\n\n        It will loop until requested to exit. This method is not reentrant and will raise an error\n        if called recursively (pika/pika#1095)\n\n        :raises: RuntimeError\n        \"\"\"\n        if self._running:\n            raise RuntimeError('IOLoop is not reentrant and is already running')\n\n        LOGGER.debug('Entering IOLoop')\n        self._running = True\n        self.activate_poller()\n\n        try:\n            # Run event loop\n            while not self._stopping:\n                self.poll()\n                self._process_timeouts()\n        finally:\n            try:\n                LOGGER.debug('Deactivating poller')\n                self.deactivate_poller()\n            finally:\n                self._stopping = False\n                self._running = False\n","sourceCodeStart":833,"sourceCodeEnd":869,"githubUrl":"https://github.com/pika/pika/blob/295ad9e5795061d759b694ab1fcb33cd381d8c49/pika/adapters/select_connection.py#L833-L869","documentation":"Error \"IOLoop is not reentrant and is already running\" thrown in pika/pika.","triggerScenarios":"Thrown at pika/adapters/select_connection.py:851 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"295ad9e5795061d759b694ab1fcb33cd381d8c49","analyzedAt":"2026-08-04T20:47:41.389Z","schemaVersion":2}