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

'NoneType' object is not iterable due to bug in threading code #118

Closed
carera opened this issue Jun 26, 2016 · 10 comments
Closed

'NoneType' object is not iterable due to bug in threading code #118

carera opened this issue Jun 26, 2016 · 10 comments

Comments

@carera
Copy link

carera commented Jun 26, 2016

Hi

for one particular repository, gitinspector just stopped working

Fetching and calculating primary statistics (1 of 2): 99%Traceback (most recent call last):
  File "../gitinspector/gitinspector.py", line 24, in <module>
    gitinspector.main()
  File "/Users/minarikj/apps/gitinspector/gitinspector/gitinspector.py", line 206, in main
    run.process(repos)
  File "/Users/minarikj/apps/gitinspector/gitinspector/gitinspector.py", line 70, in process
    changes = Changes(repo, self.hard)
  File "/Users/minarikj/apps/gitinspector/gitinspector/changes.py", line 222, in __init__
    self.commits = [item for sublist in self.commits for item in sublist]
TypeError: 'NoneType' object is not iterable

I am running Mac OS El Capitan 10.11.4
script is being run with Python 2.7

It works for other repositories, and if I git reset --hard HEAD^ (i.e. hard reset to second last commit), it works for this particular repository as well. The last commit that 'breaks' it containts nothing more than a couple of files changed and added (merge from a PR branch). Now adding a new commit on top of HEAD makes it work again.

@adam-waldenberg
Copy link
Member

adam-waldenberg commented Jun 26, 2016

Hi. Please see #115 and try to apply that fix. I think this might be related. I actually looked into this and it is related to the new threading code in changes.py.

@tomriddly
Copy link

@adam-waldenberg I found the issure may cause by uncommited(maybe unpushed?) changes. I think this might be helpful;-)

@mensfeld
Copy link

mensfeld commented Nov 4, 2016

I have the same problem when using --json (for non json works ok)

I get following error after applying patch that @adam-waldenberg suggested:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/share/gitinspector/gitinspector/blame.py", line 106, in run
    self.__handle_blamechunk_content__(row)
  File "/usr/share/gitinspector/gitinspector/blame.py", line 87, in __handle_blamechunk_content__
    if (self.blamechunk_time - self.changes.first_commit_date).days > 0:
AttributeError: 'Changes' object has no attribute 'first_commit_date'

FYI if I replace this:

CHANGES_PER_THREAD = 200
NUM_THREADS = multiprocessing.cpu_count()

with this (basically disabling multithreading):

CHANGES_PER_THREAD = 2000000
NUM_THREADS = 1

things work fine.

@hindsholm
Copy link

I run into this bug consistently on two repositories. There are no uncommitted changes. I am running ver. 0.4.4.

@adam-waldenberg
Copy link
Member

@hindsholm, As you can see from the above discussion, the Issue is well understood... I just haven't had time to sit down and actually fix it yet...

@hindsholm
Copy link

@adam-waldenberg I understand. I just wanted to let you know that the issue will also show up when there are no uncommitted changes :-)

@adam-waldenberg
Copy link
Member

@hindsholm Yes. Thank you. It's actually caused by a logic error in the threading code (overflow), causing it to end up with an empty changeset. In the meantime you can remedy it with the fix mentioned in #118 (comment).

@hindsholm
Copy link

@adam-waldenberg I have cloned the repo and applied the workaround and I can confirm that it does indeed work :-)

@mensfeld
Copy link

@hindsholm it needs to work - It runs around 2-5k times per day for me ;)

@adam-waldenberg adam-waldenberg changed the title 'NoneType' object is not iterable 'NoneType' object is not iterable due to bug in threading code May 13, 2017
@adam-waldenberg adam-waldenberg added this to the 0.4.5 milestone May 15, 2017
@adam-waldenberg
Copy link
Member

Should be fixed now. Please report any problems.

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

No branches or pull requests

5 participants