1
1
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
Go to file
Patrick Thomson 75bf696e47 Fix crash/race associated with bracket (#2207)
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.
2018-10-16 17:05:29 -04:00
.licenses/semantic/cabal fix ansi-terminal 2018-10-09 15:38:52 -04:00
app Rename SemanticCmdLine to Semantic.CLI. 2017-11-27 11:57:27 -05:00
bench Update bench to work again 2018-08-13 15:42:42 -07:00
bin Keep a bin directory around for deployments 2016-02-02 13:50:07 -06:00
proto Rename to source/target for consistently 2018-09-11 15:29:24 -07:00
script Fix tests 2018-06-22 14:19:01 -04:00
src Fix crash/race associated with bracket (#2207) 2018-10-16 17:05:29 -04:00
test Change up what Declarations we identify 2018-10-05 09:54:57 -07:00
vendor Fix crash/race associated with bracket (#2207) 2018-10-16 17:05:29 -04:00
.ghci Prevent slowdowns when pretty-printing in ghci. 2018-10-04 14:38:36 -04:00
.gitattributes Treat the licenses dir as vendored. 2017-08-15 10:49:51 -04:00
.gitignore Use better haskell code gen 2018-08-30 15:17:05 -07:00
.gitmodules Try including grpc-haskell in stack.yaml 2018-07-06 17:18:19 -04:00
.hlint.yaml New lint for projectTerm 2018-08-27 14:51:18 -07:00
.hspec Add .hspec for depths default, make sure hspec version supports 2017-02-17 08:27:51 -08:00
.stylish-haskell.yaml Make typeapplications a default extension 2018-03-26 12:00:19 -04:00
semantic.cabal Fix crash/race associated with bracket (#2207) 2018-10-16 17:05:29 -04:00
Setup.hs Use the simple build type. 2017-07-23 10:34:30 -04:00