Repository navigation
fls: fix a real crash and a goto-definition correctness/perf bug - #204
Merged
Merged
Conversation
Stored MethodTable by pointer instead of by value; also freed a duplicate method-name key's own fresh copy instead of leaking it.
…okup A later key's own hash probe can walk through an earlier key's slot on a collision; freeing each key before every lookup ran left that walk reading freed memory.
Only its own slow-path fallback ever needs the full table; every other call now only pays the one-time workspace file-discovery walk.
A shared import's cache entry got freed and replaced whenever any document with a different import graph was analyzed, even when that file's own text never changed - every other document's own merged program still borrowed strings from its freed tokens. Left to leak instead.
The setting set FLS_DEBUG_IMPORTS in the spawned process's own env, but nothing in fls ever read it; the real import-resolution error was always discarded in favor of a generic message.
Hundreds of fork/join cycles back to back stressed the scheduler; traced a real SIGABRT + corrupted import path to it.
pthread_create defaults joinable; the scheduler's elastic workers, base pool, and the deadlock watchdogs spawn and exit without ever being joined, leaking the handle (and stack reservation on glibc) every contention burst. Detach each right after a successful spawn.
A second edit landing before the first was analyzed silently overwrote has_edit_range's own range, discarding the first entirely.
A cloned Import node aliased the same owns_path string as the node it was cloned from. Whichever side's teardown ran first freed it out from under the other - the real cause of the goto/hover corruption.
Only a plain name() call's return type was resolved; name.method() fell through silently, so removing a method-call fit's own catch-all branch never warned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_free_fn_sig_mapfreed each method-table key while still probing the same live map for every other key. Open-addressing can walk through an earlier key's now-freed (but never tombstoned) slot on a hash collision, and the later lookup'sstrcmpagainst that dangling pointer is what was crashing. Split into two passes (free every value, then every key), matching the pattern already used correctly elsewhere in this file.answer_definitionwas unconditionally rebuilding the entire workspace symbol table before even trying the cheap same-file-plus-imports lookup, on every single request. Now it only pays for the one-time workspace file-discovery walk; the expensive rebuild only runs on the genuine fallback path. First call: ~1s one-time cost. Every call after: instant.Test plan
fun test .x2 clean (56/56 files)