From nobody Sat Nov 02 16:27:07 2024 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xgjmq6M8Bz5cJ81 for ; Sat, 02 Nov 2024 16:27:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xgjmq0BGdz4Q3M for ; Sat, 2 Nov 2024 16:27:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730564827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0pvwo05hiv/viv5BoaZmQ9EyBFoCL6r7/u2VFZVAzxQ=; b=j/8OjASr2RhmYhIscg8ZAtNa6yCugY1FWxE0ASRvS1ErVABvPRClszCFUsRiGxc29auKzn JccEIlHhGVUPRDi4DvxZ/azUcBD8ilg8QynSkuZMooE6FLrYobIVTAQaMYJy0aNl9A6fLL s0Xb+pS0WEm+IVzhcylHKsm6pw2EZ9pNLcy3IB8RAHw0g7ZWvSRTawzKb9p1Mf/JDRY4WN IxXQiGjixYO9kzGqDoUdl6hLJyzDL/of2fvjJCKJOUgLmggRecLVARSg1XULblR1h9KaCc 261W01MFOnmPd2N+L9NFJYxWcEx40h/tgFB6a75sar7+XJRW5YLObpvAegPsEg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730564827; a=rsa-sha256; cv=none; b=JS8NPe9hr+FeMlZQ23E+CzkU1HhCgWfQfCQ6vcp8IHm0e9nR3funfjII39ArOMS8FesP0Y Wzt3SWm4Q0+rqMsymgltikgFvRC+KgZolHUqK4kWBgls9bYzig1lSiBHbhrAF/66f1sYoG GDNH2b8ujV+xQbW8kQRLt9UJh/HCNqgGNU3LYBXp90UUuZMQ5B8dr4eVQSRn/cprfcBgts xGOZA5/orATmsee3w00EpuCY/tPpx7SkjorsLroPl5px1xShv4GjKgfD1eAUMRRfBaMg8R MwK3OiFNe3CoP8ROxXM+TsTHm+1UxcCUeSaClzaLOkmr9R9600370dYOonI6GA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xgjmp6sCtz1BKn for ; Sat, 2 Nov 2024 16:27:06 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 4A2GR6Lj010020 for ; Sat, 2 Nov 2024 16:27:06 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4A2GR6jT010019 for bugs@FreeBSD.org; Sat, 2 Nov 2024 16:27:06 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 282495] Linuxulator sendfile returns EGAIN repeatedly, actually repeatingly sending data Date: Sat, 02 Nov 2024 16:27:07 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 14.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: pieter@krikkit.xyz X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282495 Bug ID: 282495 Summary: Linuxulator sendfile returns EGAIN repeatedly, actually repeatingly sending data Product: Base System Version: 14.1-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: pieter@krikkit.xyz Created attachment 254879 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D254879&action= =3Dedit Simple Go executable that shows an adapted internal Go sendfile wrapper exercising the apparent bug I'm not currently able to dive deeper, but running a very basic Go HTTP webserver in the Linuxulator on 14.1-RELEASE-p5 gave me corrupted downloads= . I dove into the standard Go libraries and found that ultimately, sendfile is = used for such data transfers. My test code is a simplified version of the Go code that shows the main iss= ue: the linux_sendfile syscall returns EAGAIN as errno and -1 as result, BUT there's actually data being sent. This is only the case when the TCP socket= is marked as non-blocking. At EAGAIN the Go library code retries until success, which in practice means that much more data is sent than expected and piece= s of data are repeated. Every time I execute the test, the output is different. My attached test code exercises this: % go build main.go % ./main &=20 % nc -v localhost 4040 > testfile I'm stopping the loop at EAGAIN directly, but normally it would retry a num= ber of times, every time a bit of data actually being sent, but the sender not knowing about it.=20 The Linux sendfile man page indicates that sendfile can return early without having sent all data, but this isn't an error. So either linux_sendfile sh= ould return the amount of bytes sent and no error, OR not actually send any data= and return EAGAIN and -1. --=20 You are receiving this mail because: You are the assignee for the bug.=