mirror of
https://github.com/github/semantic.git
synced 2024-12-19 21:01:35 +03:00
Parsing, analyzing, and comparing source code across many languages
75bf696e47
The bracket that I wrote inside effects does not properly handle asynchronous exceptions, as it has no way to call the mask function. As such, because the asynchronous exception is rethrown by both `bracket` and `wait`, the exception handler will trigger twice. This is what is causing the crash: `bracket` is passing the TSParser we create in parseToAST to ts_parser_delete twice. The best thing to do here is to create the new `Resource` effect, which is interpreted down to `Control.Exception.bracket`, which has the correct asynchronous-masking behavior, unlike the `bracket` in `Control.Monad.Effect.Exception`, which I propose to remove in a patch to `effects`. This also bumps haskell-tree-sitter so that the `ts_node_copy_child_nodes` function is considered `interruptible`. To test: 1. Download [this file](https://gist.ghe.io/tclem/c2ffe3d20b248fdac59588aa98f168ae) 2. Run `TREE_SITTER_PARSE_TIMEOUT=1000 stack exec semantic -- --log-level=debug parse lexer.rb` Before applying this patch, you will see a crash associated with a double-free; afterwards, it should time out normally. |
||
---|---|---|
.licenses/semantic/cabal | ||
app | ||
bench | ||
bin | ||
proto | ||
script | ||
src | ||
test | ||
vendor | ||
.ghci | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
.hlint.yaml | ||
.hspec | ||
.stylish-haskell.yaml | ||
semantic.cabal | ||
Setup.hs |