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

AssertionError: Increments must match decrements, usage counter negative #24

Closed
valeriocos opened this issue Mar 25, 2015 · 2 comments
Closed

Comments

@valeriocos
Copy link

Hi,

I'm trying to import the information contained in a Git repository to a database. In order to speed up the database population process I run GitPython in a parallel way. Basically I have defined two thread pools (one for branches and tags and the other one for commits). However, it can happen that the process raise this error:

File "C:\Python27\lib\site-packages\smmap\mman.py", line 130, in use_region self._region.increment_client_count() File "C:\Python27\lib\site-packages\smmap\util.py", line 234, in increment_client_count assert self._uc > -1, "Increments must match decrements, usage counter negative: %i" % self._uc AssertionError: Increments must match decrements, usage counter negative

Do you know what is this error message about? Could you give some pointers?

thanks in advance

@Byron
Copy link
Member

Byron commented Mar 25, 2015

Hi,

The first thing that comes to my mind is that GitPython is not thread-save at all. Therefore you must not share anything related to and including the Repo object, unless all access is behind a mutex. Thus, each thread needs at least its own Repo instance. Once that is done, you might actually be hindered by the GIL, which will only be released if a thread is waiting for IO. Doing Multithreading in Python is usually prevented by it, and MultiProcessing should be used instead.

The easiest way to (possibly) gain speed in a single thread is to initialize the Repo instance with a GitCmdObjectDB.

I don't think the issue you experience is in any way related to smmap.

Good Luck - please close the issue if you see my point.

@valeriocos
Copy link
Author

thanks for your answer

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

No branches or pull requests

2 participants