Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverflowError: MongoDB can only handle up to 8-byte ints #48

Open
adarshkr06 opened this issue Mar 7, 2016 · 1 comment
Open

OverflowError: MongoDB can only handle up to 8-byte ints #48

adarshkr06 opened this issue Mar 7, 2016 · 1 comment

Comments

@adarshkr06
Copy link

Hi,

I have followed the steps given in the ReadMe.md to install and run the RouteFlow.
When run either rftest1 or rftest2, i get this error on the console:

ERROR:core:Exception while handling OpenFlowNexus!AggregateFlowStatsReceived...
Traceback (most recent call last):
File "/home/controller/RouteFlow/pox/pox/lib/revent/revent.py", line 234, in raiseEventNoErrors
return self.raiseEvent(event, _args, *_kw)
File "/home/controller/RouteFlow/pox/pox/lib/revent/revent.py", line 281, in raiseEvent
rv = event._invoke(handler, _args, *_kw)
File "/home/controller/RouteFlow/pox/pox/lib/revent/revent.py", line 159, in _invoke
return handler(self, _args, *kw)
File "/home/controller/RouteFlow/pox/ext/rfstats.py", line 148, in handle_aggregate_flow_stats
db.update(dp_id, "switch", aggregate=StatsDB.create_aggregate_stats_dict(event.stats))
File "/home/controller/RouteFlow/pox/ext/rfstats.py", line 44, in update
self.collection.update({"id": id}, self.db[id
], upsert=True)
File "/usr/lib/python2.7/dist-packages/pymongo/collection.py", line 409, in update
_check_keys, self.__uuid_subtype), safe)
OverflowError: MongoDB can only handle up to 8-byte ints

In spite of this error, it works as expected but few times it doesn't [Especially when i run RIP and OSPF].

It would be highly appreciated if you could you please tell me more about this error and steps to fix it?

Thanks in advance.

Sincerely,
Adarsh KR

@yhsu1126
Copy link

Oh I came along with the same issue too

I modify the code inside pox/etc/rfstat.py to modify it.

I don't know if it's a good approach, since it makes the mongo db doesn't record any useful data

the original code looks like this

class StatsDB: def __init__(self): self.db = {} self.connection = pymongo.Connection() self.collection = self.connection.db.rfstats

`def update(self, id_, type_, links=None, **data):
    if id_ not in self.db:
        if links is None:
            links = []
        self.db[id_] = {
            "type": type_,
            "links": links,
            "data": {},}
    else:
        self.db[id_]["type"] = type_
        if links is not None:
            self.db[id_]["links"] = links

    for k, v in data.items():
        self.db[id_]["data"][k] = v

    self.db[id_]["_id"] = id_
    self.collection.update({"_id": id_}, self.db[id_], upsert=True)

def delete(self, id_):
    try:
        del self.db[id_]
        self.collection.remove(id_)
        return True
    except:
        return False`

What I found is that when the switch push the statistic data, the package data count is bigger than 8 byte int. which cause the error

this is the code that I fix it


class StatsDB: def __init__(self): self.db = {} self.connection = pymongo.Connection() self.collection = self.connection.db.rfstats

`def update(self, id_, type_, links=None, **data):
    if id_ not in self.db:
        if links is None:
            links = []
        self.db[id_] = {
            "type": type_,
            "links": links,
            "data": {},}
    else:
        self.db[id_]["type"] = type_
        if links is not None:
            self.db[id_]["links"] = links

    for k, v in data.items():
        self.db[id_]["data"][k] = v

    self.db[id_]["_id"] = id_
    try:
    for flow in self.db[id_]["data"]["flows"]:
            if flow["packet_count"] > long(9223372036854775807):
                flow["packet_count"] = 0
        self.collection.update({"_id": id_}, self.db[id_], upsert=True)
    except KeyError:
        self.collection.update({"_id": id_}, self.db[id_], upsert=True)

def delete(self, id_):
    try:
        del self.db[id_]
        self.collection.remove(id_)
        return True
    except:
        return False`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants