# Buggy code
def __init__(self, session):
    resource.Resource.__init__(self)
    self.session = session
    self.channel_db_handler = self.session.open_dbhandler(NTFY_CHANNELCAST)
    self.events_requests = []

    self.infohashes_sent = set()
    self.channel_cids_sent = set()

    self.session.add_observer(
        self.on_search_results_channels, SIGNAL_CHANNEL, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(
        self.on_search_results_torrents, SIGNAL_TORRENT, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(self.on_upgrader_started, NTFY_UPGRADER, [NTFY_STARTED])
    self.session.add_observer(self.on_upgrader_finished, NTFY_UPGRADER, [NTFY_FINISHED])
    self.session.add_observer(self.on_upgrader_tick, NTFY_UPGRADER_TICK, [NTFY_STARTED])
    self.session.add_observer(
        self.on_watch_folder_corrupt_torrent,
        NTFY_WATCH_FOLDER_CORRUPT_TORRENT,
        [NTFY_INSERT],
    )
    self.session.add_observer(
        self.on_new_version_available, NTFY_NEW_VERSION, [NTFY_INSERT]
    )
    self.session.add_observer(self.on_tribler_started, NTFY_TRIBLER, [NTFY_STARTED])
    self.session.add_observer(
        self.on_channel_discovered, NTFY_CHANNEL, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_discovered, NTFY_TORRENT, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_removed_from_channel, NTFY_TORRENT, [NTFY_DELETE]
    )
    self.session.add_observer(self.on_torrent_finished, NTFY_TORRENT, [NTFY_FINISHED])
    self.session.add_observer(self.on_torrent_error, NTFY_TORRENT, [NTFY_ERROR])


# Traceback (RuntimeError)
Traceback (most recent call last):
File "TriblerGUI\event_request_manager.py", line 99, in on_read_data
RuntimeError: [Failure instance: Traceback: <type 'exceptions.IOError'>: [Errno 28] No space left on device
lib\site-packages\twisted\internet\base.py:1243:run
lib\site-packages\twisted\internet\base.py:1252:mainLoop
lib\site-packages\twisted\internet\base.py:878:runUntilCurrent
lib\site-packages\twisted\internet\task.py:239:__call__
--- <exception caught here> ---
lib\site-packages\twisted\internet\defer.py:150:maybeDeferred
Tribler\dispersy\discovery\community.py:809:clean_and_save
]

# Fixed code
def __init__(self, session):
    resource.Resource.__init__(self)
    self.session = session
    self.channel_db_handler = self.session.open_dbhandler(NTFY_CHANNELCAST)
    self.events_requests = []

    self.infohashes_sent = set()
    self.channel_cids_sent = set()

    self.session.add_observer(
        self.on_search_results_channels, SIGNAL_CHANNEL, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(
        self.on_search_results_torrents, SIGNAL_TORRENT, [SIGNAL_ON_SEARCH_RESULTS]
    )
    self.session.add_observer(self.on_upgrader_started, NTFY_UPGRADER, [NTFY_STARTED])
    self.session.add_observer(self.on_upgrader_finished, NTFY_UPGRADER, [NTFY_FINISHED])
    self.session.add_observer(self.on_upgrader_tick, NTFY_UPGRADER_TICK, [NTFY_STARTED])
    self.session.add_observer(
        self.on_watch_folder_corrupt_torrent,
        NTFY_WATCH_FOLDER_CORRUPT_TORRENT,
        [NTFY_INSERT],
    )
    self.session.add_observer(
        self.on_new_version_available, NTFY_NEW_VERSION, [NTFY_INSERT]
    )
    self.session.add_observer(self.on_tribler_started, NTFY_TRIBLER, [NTFY_STARTED])
    self.session.add_observer(
        self.on_channel_discovered, NTFY_CHANNEL, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_discovered, NTFY_TORRENT, [NTFY_DISCOVERED]
    )
    self.session.add_observer(
        self.on_torrent_removed_from_channel, NTFY_TORRENT, [NTFY_DELETE]
    )
    self.session.add_observer(self.on_torrent_finished, NTFY_TORRENT, [NTFY_FINISHED])
    self.session.add_observer(self.on_torrent_error, NTFY_TORRENT, [NTFY_ERROR])
    self.session.add_observer(
        self.on_resource_event, SIGNAL_RESOURCE_CHECK, [SIGNAL_LOW_SPACE]
    )