Hi
On Mon, Sep 14, 2026 at 7:00 PM Yodel Eldar <[email protected]> wrote:
>
> Hi, Marc-André and Michael
>
> On 07/09/2026 14:32, Michael S. Tsirkin wrote:
> > On Mon, Sep 07, 2026 at 06:18:39PM +0400, Marc-André Lureau wrote:
> >> Hi
> >>
> >> On Mon, Sep 7, 2026 at 5:35 PM Michael S. Tsirkin <[email protected]> wrote:
> >>>
> >>> On Mon, Sep 07, 2026 at 05:22:43PM +0400, Marc-André Lureau wrote:
> >>>>> maybe just avoid stdbuf completely.
> >>>>> i don't remember why we use it, but it looks like merely to
> >>>>> disable buffering for stdout?
> >>>>>
> >>>>> If so:
> >>>>>
> >>>>> setvbuf(stdout, NULL, _IONBF, 0);
> >>>>>
> >>>>> will do just that with no asan issues.
> >>>>>
> >>>>
> >>>> That requires modifying vhost-user-bridge, not sure that's what we want.
> >>>>
> >>>> thanks
> >>>
> >>> why not? it's not like it's a facility useful outside of testing qemu.
> >>> If we were we'd probably disable stdout printout completely.
> >>
> >> Since the test redirects stderr to stdout, I guess the log is
> >> fully-buffered for stdout and unbuffered for stderr, and we see stderr
> >> log lines in the file log before the others. If we call
> >> setvbuf(stdout, NULL, _IONBF, 0) early, we probably will get
> >> interleaved stream output, but probably broken lines...
> >
> > We can also just change that macro to write to stderr.
> >
> >> Tbh, I don't
> >> have much motivation to check or fix this, I would just like the test
> >> to be green or skipped when built with ASAN. The current workaround is
> >> quite ok. If you prefer setvbuf() in vhost-user-bridge.c, I am okay
> >> too.
> >>
> >> Yodel, wdyt?
> >
>
> Apologies for the delayed response, and thanks for finding,
> reporting, and addressing the problematic interaction
> between stdbuf and ASAN.
>
> I have implemented Michael's suggestion to modify the DPRINT
> macro to write to stderr and can attest that the log lines
> are properly interleaved even in the absence of stdbuf.
>
> If there are no objections, I'll submit the patch shortly.
> Below is a preview.
>
Yes please, thanks!
> Thanks,
> Yodel
>
> -- >8 --
>
> diff --git a/contrib/vhost-user-bridge/vhost-user-bridge.c
> b/contrib/vhost-user-bridge/vhost-user-bridge.c
> index 3f0fd0fa49..a6f7ec226c 100644
> --- a/contrib/vhost-user-bridge/vhost-user-bridge.c
> +++ b/contrib/vhost-user-bridge/vhost-user-bridge.c
> @@ -41,7 +41,7 @@
> #define DPRINT(...) \
> do { \
> if (VHOST_USER_BRIDGE_DEBUG) { \
> - printf(__VA_ARGS__); \
> + fprintf(stderr, __VA_ARGS__); \
> } \
> } while (0)
>
> diff --git a/tests/functional/x86_64/test_vhost_user_bridge.py
> b/tests/functional/x86_64/test_vhost_user_bridge.py
> index c36c625420..5e1db48884 100755
> --- a/tests/functional/x86_64/test_vhost_user_bridge.py
> +++ b/tests/functional/x86_64/test_vhost_user_bridge.py
> @@ -76,12 +76,6 @@ def configure_vm(self, ud_socket_path, lport, rport,
> hostfwd_port, tftpdir):
> def assemble_vubr_args(self, vubr_path, ud_socket_path, lport, rport):
> vubr_args = []
>
> - if (stdbuf_path := which("stdbuf")) is None:
> - self.log.info("Could not find stdbuf: vhost-user-bridge "
> - "log lines may appear out of order")
> - else:
> - vubr_args += [stdbuf_path, "-o0", "-e0"]
> -
> vubr_args += [vubr_path, "-u", f"{ud_socket_path}",
> "-l", f"127.0.0.1:{lport}", "-r",
> f"127.0.0.1:{rport}"]
>