Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Problem with hashing #171

Open
Sirorezka opened this issue Aug 29, 2018 · 1 comment
Open

Problem with hashing #171

Sirorezka opened this issue Aug 29, 2018 · 1 comment

Comments

@Sirorezka
Copy link

Sirorezka commented Aug 29, 2018

New version of 'hash' in python give different values during execution of each thread when doing multiprocessing. Following error will accure:

50000_firms/start.py return error when running in 2 or more processess:
KeyError: ('myagent', 11980)

There is problem with three functions which use 'hash':
multiprocessing.py -- def insert_or_append
multiprocessing.py -- def do
agent.py -- def _send_multiprocessing

my proposal - replace default hash function with:

import hashlib
def new_hash(agent_key):
    return int(hashlib.md5(str(agent_key).encode()).hexdigest()[:8],16)
@rht
Copy link
Member

rht commented Nov 12, 2018

Would the variable address of the string become unambiguous across processes with id(agent_name)? Perhaps a different hashing scheme is used when multiprocessing is on.

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

No branches or pull requests

2 participants