Crash on io thread with "attempt to use null value" after large pty writes #13655
Issue DescriptionI'm embedding libghostty in an app. The app crashes in src/datastruct/segmented_pool.zig . It does not appear to be limited to solely the way I use it. Expected BehaviorThe SegmentedPool does not hand out in-use values after growth. Actual BehaviorThe SegmentedPool hands out in-use values after growth. Reproduction StepsDisclosure: Copilot used to create these tests. src/datastruct/segmented_pool.zig test "SegmentedPool: growth does not hand out a checked out value" {
var pool: SegmentedPool(u8, 2) = .{};
defer pool.deinit(testing.allocator);
// Walk the head off of slot 0 so that growth has an order to preserve.
const v1 = try pool.get();
const v2 = try pool.get();
pool.put(); // returns v1, the oldest
try testing.expectEqual(v1, try pool.get());
// Checked out, oldest first: v2, v1
// Grow. Everything handed out so far is still checked out, so the two
// values this hands out have to be brand new ones.
const v3 = try pool.getGrow(testing.allocator);
const v4 = try pool.get();
try testing.expect(v3 != v1 and v3 != v2);
try testing.expect(v4 != v1 and v4 != v2 and v4 != v3);
try testing.expectError(error.OutOfValues, pool.get());
// Checked out, oldest first: v2, v1, v3, v4
// One value comes back. Values are put back in the order they were
// handed out, so that is v2, and v2 is the only value free to hand out.
pool.put();
const reused = try pool.get();
try testing.expectEqual(v2, reused);
}The above is from: Ghostty LogsNo response Ghostty VersionOS Version InformationMac Tahoe 26.6 (Linux only) Display ServerNone (Linux only) Desktop Environment/Window ManagerNo response Minimal Ghostty ConfigurationEmpty. ~/.config/ghostty/configAdditional Relevant ConfigurationNo response I acknowledge that:
|
Answered by
mitchellh
Aug 6, 2026
Replies: 3 comments 1 reply
|
Confirmed. Amazed we never hit this in Ghostty. Working on it. |
1 reply
|
Okay wait, also just to clarify, this isn't libghostty, this is ghostty-internal (our internal only library). libghostty-vt does not use segmentedpool. |
0 replies
0 replies
Answer selected by
mitchellh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#13659