v icon indicating copy to clipboard operation
v copied to clipboard

veb, macOS file write error for large files, `NS_ERROR_NET_PARTIAL_TRANSFER`

Open timurgordon opened this issue 1 year ago • 0 comments

Describe the bug

Writing a large (~11MB) pdf file fails on macOS, works on linux. Digging in, in handle_write_file, send_string_pointer fails. It seems that C.send() fails in there, outputting net: op timed out; code: 9.

Each request certain amount of bytes are sent before this occurs (sometimes 1-2 MB sometimes hundreds KB).

Reproduction Steps

module main

import veb

pub struct App{}

pub struct Context{
    veb.Context
}

pub fn (app &App) index(mut ctx Context) veb.Result {
    return ctx.file(<path_to_large_file>)
}

pub fn main() {
    mut app := &App{}
    veb.run_at[App, Context](mut app, 8080) or { panic(err) }
}

Expected Behavior

For the file to be served fully successfully.

Current Behavior

NS_ERROR_NET_PARTIAL_TRANSFER Full file isn't being transferred.

Possible Solution

No response

Additional Information/Context

Same code works on OS: linux, Ubuntu 23.10, Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 3800X 8-Core Processor

V version

V 0.4.8 11551aa

Environment details (OS name and version, etc.)

OS: macos, macOS, 14.2.1, 23C71 Processor: 8 cpus, 64bit, little endian, Apple M2

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

timurgordon avatar Oct 11 '24 13:10 timurgordon