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

Specific Markdown file fails to highlight properly #3521

Closed
sqs opened this issue Apr 20, 2019 · 2 comments
Closed

Specific Markdown file fails to highlight properly #3521

sqs opened this issue Apr 20, 2019 · 2 comments
Assignees
Labels
bug An error, flaw or fault that produces an incorrect or unexpected result, or behavior. syntect_server
Milestone

Comments

@sqs
Copy link
Member

sqs commented Apr 20, 2019

EDIT by @slimsag: This is the file: https://sourcegraph.com/github.com/GoogleChromeLabs/comlink@9517223426999ee68eb540e5059eaef853210c1d/-/blob/README.md

https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/GoogleChromeLabs/comlink%24%40v4+endpoint shows:

image

The specific GraphQL query that returned the panic error is:

{"query":"
                query HighlightedFile(
                    $repoName: String!
                    $commitID: String!
                    $filePath: String!
                    $disableTimeout: Boolean!
                    $isLightTheme: Boolean!
                ) {
                    repository(name: $repoName) {
                        commit(rev: $commitID) {
                            file(path: $filePath) {
                                isDirectory
                                richHTML
                                highlight(disableTimeout: $disableTimeout, isLightTheme: $isLightTheme) {
                                    aborted
                                    html
                                }
                            }
                        }
                    }
                }
            ",
"variables":{"repoName":"github.com/GoogleChromeLabs/comlink","commitID":"5d1932c18c3f0b7dc480b4daf363753733d3730d","filePath":"README.md","isLightTheme":false,"disableTimeout":true}}

Assigning to @attfarhan as search frontend owner but @slimsag may be able to give ideas. Adding to 3.4 because this is a bug in a core feature (therefore important). I have never seen this before, so if it is rare or due to temporary deployment/infra problems on Sourcegraph.com, please backlog.

@sqs sqs added bug An error, flaw or fault that produces an incorrect or unexpected result, or behavior. search labels Apr 20, 2019
@sqs sqs added this to the 3.4 milestone Apr 20, 2019
@slimsag
Copy link
Member

slimsag commented Apr 23, 2019

  1. This isn't a regression, we just fail to highlight some files. In fact, the behavior here recently improved substantially as we now return an error instead of crashing the entire syntect_server which hurt other requests.
  2. This is the first case I've seen of us failing to highlight a markdown file -- quite strange. It is likely this could just be fixed by upgrading syntect, which I plan to do this version but of course that is tricky to do right.
  3. I've further improved this behavior by falling back to plaintext rendering when syntect does panic, so we'll always at least get a plaintext form. It'll be live in prod in a bit, so this is good enough for now. I am backlogging and assigning to myself to investigate the specific file highlighting failure later.

@slimsag slimsag modified the milestones: 3.4, Backlog Apr 23, 2019
@slimsag slimsag assigned slimsag and unassigned attfarhan Apr 23, 2019
@slimsag slimsag changed the title Panic while highlighting code in search results Specific Markdown file fails to highlight properly Apr 23, 2019
@eseliger
Copy link
Member

This file seems to highlight properly now:

image

I think we can close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error, flaw or fault that produces an incorrect or unexpected result, or behavior. syntect_server
Projects
None yet
Development

No branches or pull requests

5 participants