Skip to content

Python 2.7/3.6: issue with output line buffering #597

@thiell

Description

@thiell

I discovered today that the fix for #528 might have affected line output buffering in Python 2.7 and possibly Python 3.6. This can be a problem when clush commands are piped to other tools like grep.

Reproducer below. I'm using lctl mark to display a debug marker in syslog while clush | grep is running.

In Python 2.7.5 (EL7), it only works if PYTHONUNBUFFERED is set to 1 (ugly).

# clush -w oak-h05v[06,16-17] journalctl -n0 -fk | grep MARKER
<nothing... this is the bug>

# PYTHONUNBUFFERED=1 clush -w oak-h05v[06,16-17] journalctl -n0 -fk | grep MARKER
oak-h05v06: Dec 02 18:42:24 oak-h05v06.sunet kernel: Lustre: DEBUG MARKER: Tue Dec  2 18:42:24 2025
...

In Python 3.9.18 (EL9), we're good by default:

# clush -w elm-rcf-mr-h[01-04]s01 journalctl -n0 -fk  | grep MARKER
elm-rcf-mr-h01s01: Dec 02 18:46:38 elm-rcf-mr-h01s01 kernel: Lustre: DEBUG MARKER: Tue Dec  2 18:46:38 2025

Not sure how much effort we want to put into fixing this as nobody has reported it and Python 2.7/3.6 are both quite old.

The impacted code is likely here:

# GH#528 enable line buffering

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions