cirosantilli / linux-kernel-module-cheat

The perfect emulation setup to study and develop the Linux kernel v5.4.3, kernel modules, QEMU, gem5 and x86_64, ARMv7 and ARMv8 userland and baremetal assembly, ANSI C, C++ and POSIX. GDB step debug and KGDB just work. Powered by Buildroot and crosstool-NG. Highly automated. Thoroughly documented. Automated tests. "Tested" in an Ubuntu 24.04 host.
https://cirosantilli.com/linux-kernel-module-cheat
GNU General Public License v3.0
4.21k stars 605 forks source link

BrokenPipeError: [Errno 32] Broken pipe and BlockingIOError #48

Open cirosantilli opened 5 years ago

cirosantilli commented 5 years ago

Sometimes when running, I get, very rarely this error. It is very hard to reproduce and fix... linked to python reading stdout. Python, I both love and hate you.

common.run_cmd let it pipe properly, e.g.:

./run-toolchain -aA --baremetal all objdump -- -S ./out/baremetal/aarch64/qemu/virt/main.elf | less

gives after closing:

Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

BlockingIOError

Got this one randomly once as well at a30ed0f047523ff2368d421ee2cce0800682c44e, likely related, OMG:

  File "./build-buildroot", line 178, in <module>
    Main().cli()
  File "/path/to/linux-kernel-module-cheat/cli_function.py", line 258, in cli
    exit_status = self.cli_noexit(*args, **kwargs)
  File "/path/tolinux-kernel-module-cheat/cli_function.py", line 249, in cli_noexit
    return self._do_main(vars(args))
  File "/path/tolinux-kernel-module-cheat/cli_function.py", line 148, in _do_main
    return self.main(**self._get_args(kwargs))
  File "/path/to/linux-kernel-module-cheat/common.py", line 1005, in main
    ret = self.timed_main()
  File "/path/to/linux-kernel-module-cheat/common.py", line 1203, in timed_main
    return self.build()
  File "./build-buildroot", line 163, in build
    cwd=self.env['buildroot_source_dir'],
  File "/path/to/linux-kernel-module-cheat/shell_helpers.py", line 257, in run_cmd
    sys.stdout.buffer.write(byte)
BlockingIOError: [Errno 11] write could not complete without blocking

This might be a good way to reproduce at 8f73910dd1fc1fa6dc6904ae406b7598cdcd96d7, as it produces a lot of outupt really fast:

./run   --arch aarch64   --baremetal baremetal/arch/aarch64/svc.c   -- -d in_asm,int