#is this compiler segfault in Io.netLookup a known issue?

1 messages · Page 1 of 1 (latest)

idle nacelle
#

I'm trying to update my flatbufferz project to master and it was segfaulting since around the time Io.Threaded was introduced to master. I checked again today with 0.16.0-dev.1262+be4eaed7c and it still segfaults. So I made a debug build of the compiler to get the following error trace. This is a fedora linux (6.16.8 kernel) box.

#
$ zig build
Compiler crash context:
(no context)

thread 2603657 panic: reached unreachable code
~/zig/zig/lib/std/debug.zig:416:14: 0x1bff5b9 in assert (std.zig)
    if (!ok) unreachable; // assertion failure
             ^
~/zig/zig/lib/std/Io/Reader.zig:521:11: 0x1cf1af8 in toss (std.zig)
    assert(r.seek <= r.end);
          ^
~/zig/zig/lib/std/Io/Threaded.zig:5538:20: 0x20cbd76 in lookupHostsReader (std.zig)
        reader.toss(1);
                   ^
~/zig/zig/lib/std/Io/Threaded.zig:5502:29: 0x1f8a1de in lookupHosts (std.zig)
    return lookupHostsReader(t, host_name, resolved, options, &file_reader.interface) catch |err| switch (err) {
                            ^
~/zig/zig/lib/std/Io/Threaded.zig:4841:20: 0x1f8ab1a in netLookupFallible (std.zig)
        lookupHosts(t, host_name, resolved, options) catch |err| switch (err) {
                   ^
~/zig/zig/lib/std/Io/Threaded.zig:4703:66: 0x1f8b87c in netLookup (std.zig)
    resolved.putOneUncancelable(t_io, .{ .end = netLookupFallible(t, host_name, resolved, options) });
                                                                 ^
~/zig/zig/lib/std/Io/net/HostName.zig:98:31: 0x5b1bb62 in lookup (std.zig)
    return io.vtable.netLookup(io.userdata, host_name, resolved, options);
                              ^
~/zig/zig/lib/std/Io.zig:1034:17: 0x56de77b in start (std.zig)
                @call(.auto, function, args_casted.*);
                ^
~/zig/zig/lib/std/Io/Threaded.zig:605:16: 0x1cd9e3d in start (std.zig)
        gc.func(group, gc.contextPointer());
               ^
#
~/zig/zig/lib/std/Io/Threaded.zig:188:26: 0x1d67c56 in worker (std.zig)
            closure.start(closure);
                         ^
~/zig/zig/lib/std/Thread.zig:558:13: 0x1d3cc20 in callFn__anon_42307 (std.zig)
            @call(.auto, f, args);
            ^
~/zig/zig/lib/std/Thread.zig:830:30: 0x1d12a09 in entryFn (std.zig)
                return callFn(f, args_ptr.*);
                             ^
???:?:?: 0x7fb3d0106f53 in start_thread (/lib64/libc.so.6)
???:?:?: 0x7fb3d018a32b in __clone3 (/lib64/libc.so.6)
Compiler crash context:
(no context)

thread 2603659 panic: reached unreachable code
Aborted (core dumped)
#

I'm guessing this means the assert is tripped during a package download. This lib depends on

    .dependencies = .{
        .flagset = .{
            .url = "git+https://github.com/travisstaloch/flagset#7379f252b2f49105bbf004ba7f9b46bacd14241e",
        },
        .flatbuffers = .{
            .url = "https://github.com/google/flatbuffers/archive/refs/tags/v24.3.25.tar.gz",
        },
    },

Does anyone know if this is a known issue? I did a quick search of github issues and didn't find anything that matched. I know there was some (maybe similar) issue on windows relating to TLS but I'm not sure if this is related.

If you want to try to reproduce, you should be able to clone https://github.com/travisstaloch/flatbufferz/ and run zig build with a zig version after 0.16.0-dev.1225.

#

Let me know if you have any insight and/or recommendations of next steps to take.

#

is this compiler segfault in Io.netLookup a known issue?

idle nacelle
#

Yeah this appears to happening while downloading the flatbuffers.tag.gz dep file. Here is a repro from https://github.com/ziglang/zig/issues/25776#issuecomment-3485661834 but with my dep file path.

const std = @import("std");

pub fn main() !void {
    var debug_allocator: std.heap.DebugAllocator(.{}) = .{};
    defer std.debug.assert(debug_allocator.deinit() == .ok);
    const gpa = debug_allocator.allocator();

    var threaded: std.Io.Threaded = .init(gpa);
    defer threaded.deinit();
    const io = threaded.io();

    var client: std.http.Client = .{ .io = io, .allocator = gpa };
    defer client.deinit();

    var body: std.Io.Writer.Allocating = .init(gpa);
    defer body.deinit();

    const res = try client.fetch(.{
        .location = .{ .url = "https://github.com/google/flatbuffers/archive/refs/tags/v24.3.25.tar.gz" },
        .method = .GET,
        .response_writer = &body.writer,
    });

    std.debug.print("{}\n", .{res.status});
    std.debug.print("{s}\n", .{body.written()});
}
#

this trace looks the same as above Io.vtable.netLookup, lookupHosts, ...

#

guess i'll open an issue

idle nacelle