This repository was archived by the owner on Sep 14, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continue serving requests when highlighting an individual file fails
When Syntect fails to highlight a file it often does so by panicking. Most often these issues come from us making use of syntax definitions which simply aren't supported by Syntect very well (e.g. they use some new or obscure ST3 feature). There is an upstream issue to [return a `Result` type instead of panicking](trishume/syntect#98) when this occurs. Prior to this change, a user requesting syntect_server to highlight a bad file (i.e. hitting a case in the syntax definition not supported by Syntect) would result in `syntect_server` dying. This has been a known issue for a while, but in practice hasn't been that bad because these cases are relatively rare and Kubernetes / Docker restarts the process very quickly anyway. However, when it does occur it terminates all ongoing highlighting requests which causes blips that users see. After this change, we handle these panics by catching and unwinding the stack. This isn't perfect / ideal / idiomatic Rust code (see the `catch_unwind` docs), but it does solve the problem and is a better approach than e.g. adding more replicas of this service. Fixes sourcegraph/sourcegraph#3164
- Loading branch information