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

Crash on route update: panic: runtime error: index out of range, diffmatchpatch.(*DiffMatchPatch).DiffCharsToLines #873

Closed
ddreier opened this issue May 15, 2022 · 3 comments

Comments

@ddreier
Copy link
Contributor

ddreier commented May 15, 2022

After upgrading to 1.6.0 our Fabio instances with the largest number of routes (over 50k) started crashing with the following:

panic: runtime error: index out of range [65533] with length 55828
goroutine 75 [running]:
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffCharsToLines(0xc0983f555302fcc9?, {0xc0174f4000, 0x87, 0xc03acf4000?}, {0xc017aca000, 0xda14, 0xc033cd1c2c?})
        /Users/njohnson/jetbrains/fabio/pkg/mod/github.com/sergi/go-diff@v1.1.0/diffmatchpatch/diff.go:452 +0x2bb
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).diffLineMode(0x466cae?, {0xc03194223c?, 0xc005f31c18?, 0x4b6c000?}, {0xc0364c423c, 0x11c257f, 0x120bf71}, {0xc0983f555302fcc9, 0x159d044387, 0x1310640})
        /Users/njohnson/jetbrains/fabio/pkg/mod/github.com/sergi/go-diff@v1.1.0/diffmatchpatch/diff.go:201 +0x15e
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).diffCompute(0x4b6c000?, {0xc03194223c?, 0x4b6c000?, 0xc036188000?}, {0xc0364c423c?, 0x40d539?, 0x120bf71}, 0x1, {0xc0983f555302fcc9, 0x159d044387, ...})
        /Users/njohnson/jetbrains/fabio/pkg/mod/github.com/sergi/go-diff@v1.1.0/diffmatchpatch/diff.go:188 +0x8c7
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).diffMainRunes(0x3b9aca00?, {0xc031606000?, 0x12dafc4?, 0xffffffffffffffff?}, {0xc036188000?, 0x4dac73?, 0x12dafc4?}, 0x0?, {0xc0983f555302fcc9, 0x159d044387, ...})
        /Users/njohnson/jetbrains/fabio/pkg/mod/github.com/sergi/go-diff@v1.1.0/diffmatchpatch/diff.go:119 +0x2bb
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffMainRunes(0xc005f31de0?, {0xc031606000?, 0x12e073c?, 0x12e0800?}, {0xc036188000?, 0x12dafc4?, 0x12db000?}, 0x1?)
        /Users/njohnson/jetbrains/fabio/pkg/mod/github.com/sergi/go-diff@v1.1.0/diffmatchpatch/diff.go:95 +0xd9
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffMain(...)
        /Users/njohnson/jetbrains/fabio/pkg/mod/github.com/sergi/go-diff@v1.1.0/diffmatchpatch/diff.go:85
main.logRoutes(0xc0003d9230?, {0xc01ccea000, 0x12e073c}, {0xc02d32a000, 0x12dafc4}, {0xcb8033?, 0xc00007f1a0?})
        /Users/njohnson/jetbrains/fabio/src/github.com/fabiolb/fabio/main.go:663 +0x19e
main.watchBackend(0xc0000d2a00, {0xc0003b17d0?, 0x6ef9a6?}, 0xc0000c2c60)
        /Users/njohnson/jetbrains/fabio/src/github.com/fabiolb/fabio/main.go:614 +0x477
created by main.main
        /Users/njohnson/jetbrains/fabio/src/github.com/fabiolb/fabio/main.go:140 +0x7f4

Ultimately it seems like the issue is probably in github.com/sergi/go-diff. But wanted to open this in case any one else runs into it.

@ddreier
Copy link
Contributor Author

ddreier commented May 15, 2022

Looks like this might have been fixed in github.com/sergi/go-diff v1.2.0 based on sergi/go-diff#117.

@nathanejohnson
Copy link
Member

Thank you for finding this! This will be incorporated with the next minor release, which should be very soon.

nathanejohnson added a commit that referenced this issue Jul 8, 2022
Bump go-diff dependency version to 1.2.0.  Fixes #873
@ddreier
Copy link
Contributor Author

ddreier commented Jul 13, 2022

Thanks! I tested and it looks like our issue is fixed.

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

2 participants