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

Extinctions scan fails for large file diffs #351

Closed
ffluk3 opened this issue May 15, 2023 · 4 comments · Fixed by #425
Closed

Extinctions scan fails for large file diffs #351

ffluk3 opened this issue May 15, 2023 · 4 comments · Fixed by #425
Labels
bug Something isn't working dependencies Pull requests that update a dependency file known issue

Comments

@ffluk3
Copy link
Contributor

ffluk3 commented May 15, 2023

When running ld-find-code-refs, we see the following error:

panic: runtime error: index out of range [65533] with length 55989

goroutine 1 [running]:
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffCharsToLines(0xc000fe4620?, {0xc00189e930, 0x1, 0x11000?}, {0xc00de3c000, 0xdab5, 0x11000?})
	/tmp/project-releaser/project/vendor/github.com/sergi/go-diff/diffmatchpatch/diff.go:452 +0x2bb
github.com/go-git/go-git/v5/utils/diff.DoWithTimeout({0xc00b036000?, 0x0?}, {0xc00ca1c000?, 0x800?}, 0x7f453cc8f108?)
	/tmp/project-releaser/project/vendor/github.com/go-git/go-git/v5/utils/diff/diff.go:37 +0x11d
github.com/go-git/go-git/v5/utils/diff.Do(...)
	/tmp/project-releaser/project/vendor/github.com/go-git/go-git/v5/utils/diff/diff.go:22
github.com/go-git/go-git/v5/plumbing/object.filePatchWithContext({0xbdad68, 0xc00013c000}, 0xc00706f200)
	/tmp/project-releaser/project/vendor/github.com/go-git/go-git/v5/plumbing/object/patch.go:68 +0x192
github.com/go-git/go-git/v5/plumbing/object.getPatchContext({0xbdad68, 0xc00013c000}, {0x0, 0x0}, {0xc00195adc0, 0x57, 0x0?})
	/tmp/project-releaser/project/vendor/github.com/go-git/go-git/v5/plumbing/object/patch.go:38 +0xf4
github.com/go-git/go-git/v5/plumbing/object.Changes.PatchContext(...)
	/tmp/project-releaser/project/vendor/github.com/go-git/go-git/v5/plumbing/object/change.go:158
github.com/launchdarkly/ld-find-code-refs/internal/git.Client.FindExtinctions({{0x7ffccf09be80, 0x5}, {0xc00013de88, 0x8}, {0xc0001258f0, 0x28}, 0x188209ab5b0}, {{0x7ffccf09bd4b, 0x7}, {0x0, ...}, ...}, ...)
	/tmp/project-releaser/project/internal/git/git.go:264 +0x54e
github.com/launchdarkly/ld-find-code-refs/coderefs.runExtinctions({{0x7ffccf09bd18, 0x28}, {0x7ffccf09bd97, 0x1c}, {0x0, 0x0}, {0x0, 0x0}, {0x7ffccf09be09, 0x7}, ...}, ...)
	/tmp/project-releaser/project/coderefs/coderefs.go:183 +0x745
github.com/launchdarkly/ld-find-code-refs/coderefs.Run({{0x7ffccf09bd18, 0x28}, {0x7ffccf09bd97, 0x1c}, {0x0, 0x0}, {0x0, 0x0}, {0x7ffccf09be09, 0x7}, ...}, ...)
	/tmp/project-releaser/project/coderefs/coderefs.go:75 +0x9db
main.glob..func3(0xf9e6c0?, {0xaddcdf?, 0x11?, 0x11?})
	/tmp/project-releaser/project/cmd/ld-find-code-refs/main.go:83 +0x145
github.com/spf13/cobra.(*Command).execute(0xf9e6c0, {0xc00012c010, 0x11, 0x11})
	/tmp/project-releaser/project/vendor/github.com/spf13/cobra/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xf9e6c0)
	/tmp/project-releaser/project/vendor/github.com/spf13/cobra/command.go:1044 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
	/tmp/project-releaser/project/vendor/github.com/spf13/cobra/command.go:968
main.main()
	/tmp/project-releaser/project/cmd/ld-find-code-refs/main.go:97 +0x9f

Exited with code exit status 2

This appears to be related to this bug in go-diff, so a version bump might suffice for now (though it's worth noting that a second PR is out for other fixes related to this)

@jazanne
Copy link
Contributor

jazanne commented May 16, 2023

@ffluk3 sorry to hear you are running into this issue.

Can you confirm which version of ld-find-code-refs you are using?

@jazanne jazanne added bug Something isn't working dependencies Pull requests that update a dependency file labels May 16, 2023
@danshort
Copy link

I just opened a support ticket and was pointed to this issue. I'm also seeing this with a new action we created for a repo.

    - name: LaunchDarkly Code References
      uses: launchdarkly/[email protected]

@ffluk3
Copy link
Contributor Author

ffluk3 commented Aug 24, 2023

It looks like a few weeks ago the upstream go-diff version fixed issues which could prevent upgrading. I can send over a version bump PR!

ffluk3 added a commit to ffluk3/ld-find-code-refs that referenced this issue Aug 24, 2023
Resolves launchdarkly#351, where the tool would throw index out of range errors for
sufficiently large source code diffs. The downstream library was
recently updated to allow for significantly larger diff max sizes, as
discussed in the associated issue.
@ffluk3
Copy link
Contributor Author

ffluk3 commented Aug 24, 2023

@jazanne we were seeing it on v2.10.0, and it makes sense we would even see it on latest until we bump the downstream library to take in the change. PR is up if y'all are willing to take it in!

ffluk3 added a commit to ffluk3/ld-find-code-refs that referenced this issue Jan 23, 2024
Resolves launchdarkly#351, where the tool would throw index out of range errors for
sufficiently large source code diffs. The downstream library was
recently updated to allow for significantly larger diff max sizes, as
discussed in the associated issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file known issue
Projects
None yet
3 participants