icarus-sim / icarus

A scalable simulator for evaluating the performance of in-network caches in Information Centric Networking (ICN)

Home Page:http://icarus-sim.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using PERFECT_LFU cache policy and some strategy along with ttl_cache function

kssoftware93 opened this issue · comments

Hello
I get the following error when I use the following PERFECT LFU cache policy together with the ttl_cache function and increase the following parameters.This problem exists on most of the existing strategies (such as CL4M)
params

N_WARMUP_REQUESTS = 1* 10 ** 3    --to-->  N_WARMUP_REQUESTS = 6* 10 ** 4
N_MEASURED_REQUESTS = 1* 10 ** 3    ----to--->   N_MEASURED_REQUESTS = 6* 10 ** 4

error
ERROR|orchestration] FAILURE | Experiment failed: list index out of range

I think I found the problem
In the code below, the type of data set is guest, but you used pop function to remove the data
source:https://github.com/icarus-sim/icarus/blob/master/icarus/models/cache/policies.py

@register_cache_policy("PERFECT_LFU")

    @inheritdoc(Cache)
    def __init__(self, maxlen, *args, **kwargs):
        self._counter = {}
        self._cache = set() # <----------- use set Data Type
        self.t = 0
        self._maxlen = int(maxlen)
        if self._maxlen <= 0:
            raise ValueError("maxlen must be positive")

    @inheritdoc(Cache)
    def remove(self, k, *args, **kwargs):
        if k in self._cache:
            self._cache.pop(k)  #--------> error  ----ok-->   self._cache.remove(k)  <--ok----
            return True
        else:
            return False

Good catch! Thank you. Pushed 8f42b48 which should fix the issue