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

Retrieving events throws Stack.Overflow exception. #1979

Closed
bobbytreed opened this issue Aug 6, 2019 · 18 comments · Fixed by #2092
Closed

Retrieving events throws Stack.Overflow exception. #1979

bobbytreed opened this issue Aug 6, 2019 · 18 comments · Fixed by #2092
Assignees
Labels
Type: Bug Something isn't working as documented

Comments

@bobbytreed
Copy link

In the lastest local build (0.33.0), I still get a StackOverflow Exception. While the type has been updated, something in PocoSerializationStrategy is still trying to convert to Int32
System.AggregateException: One or more errors occurred. ---> System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Int64 value)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type)
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type)
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type)
at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy)
at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response)
at Octokit.Connection.d__571.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.ApiConnection.<GetPage>d__421.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Octokit.ApiConnection.<>c__DisplayClass17_01.<<GetAll>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.ApiPagination.<GetAllPages>d__01.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Int64 value)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type)
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type)
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type)
at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy)
at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response)
at Octokit.Connection.d__571.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.ApiConnection.<GetPage>d__421.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Octokit.ApiConnection.<>c__DisplayClass17_01.<<GetAll>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.ApiPagination.<GetAllPages>d__01.MoveNext()<---

@ryangribble
Copy link
Contributor

It could be another field that needs to change from int to long

Are you able to post a code snippet that reproduces it on a public repository?

1 similar comment
@ryangribble
Copy link
Contributor

It could be another field that needs to change from int to long

Are you able to post a code snippet that reproduces it on a public repository?

@bobbytreed
Copy link
Author

I was just creating a github client in powershell and trying to query all events for a repo.

As for the code, I didnt change it. I built directly from the cloned repo.

I'll admit maybe I did something wrong, but I really can't guess what.

@shiftkey
Copy link
Member

shiftkey commented Aug 7, 2019

I was just creating a github client in powershell and trying to query all events for a repo.

@bobbytreed if you can reproduce this against a public repository and can share that with us it'll help us to reproduce the issue on our end and identify what field returned from the API now overflows int.

@bobbytreed
Copy link
Author

I fixed it locally by changing IssueEvent ID to a long as well. I still hit an issue though with pagination.

Exception : System.AggregateException: One or more errors occurred. ---> Octokit.ApiValidationException: In order to
keep the API fast for everyone, pagination is limited for this resource. Check the rel=last link relation
in the Link response header to see how far back you can traverse.
at Octokit.Connection.HandleErrors(IResponse response)

@shiftkey
Copy link
Member

shiftkey commented Aug 7, 2019

@bobbytreed some sample code would still be handy so we can understand how you're encountering issues

@bobbytreed
Copy link
Author

$inmem = new-object OctoKit.Internal.InMemoryCredentialStore -ArgumentList ($cred)
$header = New-Object octokit.productheadervalue -ArgumentList "azure-function"
New-Variable -Name gitHubClient -Scope Global -Option AllScope -Force -Value $(new-object octokit.githubclient -ArgumentList $header, $inmem)
$options = New-Object octokit.apioptions
$options.pagesize = 100
$events = $gitHubClient.Issue.Events.GetAllForRepository("","", $options)

@shiftkey
Copy link
Member

@bobbytreed apologies for the delay. I see that this last line doesn't have the owner and repo values:

$events = $gitHubClient.Issue.Events.GetAllForRepository("","", $options)

If this is reproducible on a public repository that'll greatly help to speed up reproducing this issue.

@hnrkndrssn
Copy link
Contributor

hnrkndrssn commented Sep 13, 2019

If this is reproducible on a public repository that'll greatly help to speed up reproducing this issue.

This will should do it $events = $gitHubClient.Issue.Events.GetAllForRepository("OctopusDeploy", "Issues", $options)

@shiftkey shiftkey self-assigned this Sep 13, 2019
@mynkow
Copy link

mynkow commented Nov 6, 2019

This fails for me with the following exception:

System.OverflowException: 'Value was either too large or too small for an Int32.'

image

NOTE: I guess mine is a different issue...

@shiftkey
Copy link
Member

This feels very similar to #2031, and while we have a PR started in #2037 this appears to have stalled. Gonna leave these both open for now and re-test the fix to confirm both issues are resolved.

@shiftkey shiftkey removed their assignment Nov 18, 2019
@mijacobs
Copy link

This feels very similar to #2031, and while we have a PR started in #2037 this appears to have stalled. Gonna leave these both open for now and re-test the fix to confirm both issues are resolved.

Any update on this? It looks like the PR still hasn't gone through.

@shiftkey
Copy link
Member

@mijacobs it turns out that #2060 doesn't fix this, but #2092 will

@bifacil
Copy link

bifacil commented Feb 22, 2024

Any update on this?

The bug exists on latest version (9.1.2)

Inner Exception (System.OverflowException): Value was either too large or too small for an Int32.
at System.Convert.ThrowInt32OverflowException()
at System.Convert.ToInt32(Int64 value)
at System.Int64.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in //Octokit/SimpleJson.cs:line 1437
at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /
/Octokit/Http/SimpleJsonSerializer.cs:line 183
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in //Octokit/SimpleJson.cs:line 1492
at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /
/Octokit/Http/SimpleJsonSerializer.cs:line 183
at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) in //Octokit/SimpleJson.cs:line 1519
at Octokit.Internal.SimpleJsonSerializer.GitHubSerializerStrategy.DeserializeObject(Object value, Type type) in /
/Octokit/Http/SimpleJsonSerializer.cs:line 183
at Octokit.SimpleJson.DeserializeObject(String json, Type type, IJsonSerializerStrategy jsonSerializerStrategy) in //Octokit/SimpleJson.cs:line 584
at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy) in /
/Octokit/SimpleJson.cs:line 596
at Octokit.Internal.SimpleJsonSerializer.Deserialize[T](String json) in //Octokit/Http/SimpleJsonSerializer.cs:line 22
at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response) in /
/Octokit/Http/JsonHttpPipeline.cs:line 60
at Octokit.Connection.Run[T](IRequest request, CancellationToken cancellationToken, Func2 preprocessResponseBody) in /_/Octokit/Http/Connection.cs:line 753 at Octokit.ApiConnection.GetPage[TU](Uri uri, IDictionary2 parameters, String accepts, ApiOptions options, Func2 preprocessResponseBody) in /_/Octokit/Http/ApiConnection.cs:line 695 at Octokit.ApiConnection.<>c__DisplayClass20_01.<b__0>d.MoveNext() in /_/Octokit/Http/ApiConnection.cs:line 240
--- End of stack trace from previous location ---
at Octokit.ApiPagination.GetAllPages[T](Func`1 getFirstPage, Uri uri)

@bifacil
Copy link

bifacil commented Feb 22, 2024

Some property need to be changed from int to long...

image

@bifacil
Copy link

bifacil commented Feb 22, 2024

Same issue here: #2889

@maddada
Copy link

maddada commented Feb 26, 2024

Facing the same issue all of a sudden, any solutions?

"Value was either too large or too small for an Int32."

at System.Convert.ToInt32(Int64 value) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy) at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response) at Octokit.Connection.<Run>d__67'1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.ApiConnection.<Get>d__8'1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter'1.GetResult() at LicenseManager.Controllers.Api.GithubReportsController.<GetPullRequestsReport>d__1.MoveNext() in <MyProjectName>\Controllers\Api\GithubReportsController.cs:line 79

@bifacil
Copy link

bifacil commented Feb 26, 2024

Facing the same issue all of a sudden, any solutions?

"Value was either too large or too small for an Int32."

at System.Convert.ToInt32(Int64 value) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.PocoJsonSerializerStrategy.DeserializeObject(Object value, Type type) at Octokit.SimpleJson.DeserializeObject[T](String json, IJsonSerializerStrategy jsonSerializerStrategy) at Octokit.Internal.JsonHttpPipeline.DeserializeResponse[T](IResponse response) at Octokit.Connection.<Run>d__67'1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Octokit.ApiConnection.<Get>d__8'1.MoveNext() at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter'1.GetResult() at LicenseManager.Controllers.Api.GithubReportsController.<GetPullRequestsReport>d__1.MoveNext() in <MyProjectName>\Controllers\Api\GithubReportsController.cs:line 79

Update top 10.0.

It's solved.

#2889

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants