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

Generate images error #2

Closed
bconnorwhite opened this issue Sep 10, 2020 · 8 comments
Closed

Generate images error #2

bconnorwhite opened this issue Sep 10, 2020 · 8 comments

Comments

@bconnorwhite
Copy link

Getting this error:

Run python3 --version
Python 3.8.5
Traceback (most recent call last):
  File "generate_images.py", line 105, in <module>
    asyncio.run(main())
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "generate_images.py", line 101, in main
    await asyncio.gather(generate_languages(s), generate_overview(s))
  File "generate_images.py", line 41, in generate_overview
    changed = (await s.lines_changed)[0] + (await s.lines_changed)[1]
  File "/home/runner/work/github-stats/github-stats/github_stats.py", line 435, in lines_changed
    r = await self.queries.query_rest(f"/repos/{repo}/stats/contributors")
  File "/home/runner/work/github-stats/github-stats/github_stats.py", line 93, in query_rest
    return r.json()
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
##[error]Process completed with exit code 1.
@jstrieb
Copy link
Owner

jstrieb commented Oct 2, 2020

Hi, unfortunately, I'm not able to replicate this error. Can you provide any additional information about when this took place?

Also, apologies for the late reply. Thanks for using this project!

@bconnorwhite
Copy link
Author

bconnorwhite commented Oct 5, 2020

Looks like the json decode error has been fixed, now I'm getting endless A path returned 202. Retrying... in Generating images. Here's my fork: https://github.com/bconnorwhite/github-stats

Looks like the same as #3

@jstrieb
Copy link
Owner

jstrieb commented Oct 5, 2020

Thanks for mentioning this, those are definitely the same issue.

The problem is probably the GitHub statistics API. For more information see this note in the API docs. To summarize that documentation: the API takes a long time to assemble some repo statistics, and doesn't know how long this operation will take, so it just indefinitely returns 202s unless a repo has cached statistics. If there are lots of repos with complex statistics that aren't cached, it will take a very long time (as you have seen first-hand), even with 10 asynchronous connections. I'm not totally sure why this originally eventually failed with an error, but I don't actually think the error is the heart of the problem – I think working around the limitations of the API with regards to timing will and avoid the complicated issue of replicating the code failure directly.

That being said, I've been meaning to push a workaround to this, but have been way too busy for the last little while. I think adding a timeout would be beneficial, even though it would mean that the resulting traffic statistics would be incomplete.

@jstrieb jstrieb closed this as completed in f44d675 Oct 5, 2020
@jstrieb jstrieb reopened this Oct 5, 2020
@jstrieb
Copy link
Owner

jstrieb commented Oct 5, 2020

Didn't mean to close this. Apparently putting "Fix #2" in the commit message auto-closes an issue.

I just pushed something I hope will fix the issue, but I am not totally sure. To be precise: I changed the infinite loop that generates all of the 202s into a loop with a max number of tries that returns incomplete data as a fallback. Please merge the change into your fork and see if it works better.

@jstrieb
Copy link
Owner

jstrieb commented Oct 5, 2020

I pushed some fixes that seem to have resolved #3. Please merge the fixes, and if it works for you, I will close this issue.

@bconnorwhite
Copy link
Author

Awesome, looks like that worked

@matshou
Copy link

matshou commented Feb 12, 2021

I am also getting this error/warning message:

A path returned 202. Retrying...

However the action does not fail, should I be worried?

@jstrieb
Copy link
Owner

jstrieb commented Feb 12, 2021

@yooksi this is normal, and is part of GitHub's API response related to caching. It shouldn't significantly impact the output statistics, nor should it cause any fatal errors in the workflow.

Cyklos89 referenced this issue in mahendrasaikumargandham/mahendrasaikumargandham Oct 25, 2021
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

3 participants