Raciness #1

Open
opened 3 weeks ago by itycodes · 0 comments
Owner

There's several conditions in which this is racy. Specifically, when a program writes large amounts into both STDOUT and STDERR, poll will return 2 (data is available on both PTYs), and I have no way of telling them apart.

I am using two PTYs to do the fancy splitting between STDOUT and STDERR. If I abandon this feature, I can just let the kernel sort out the ordering.

I have several choices here:

  • Rewrite this using ptrace (has its own downsides due to ptrace limitations)
  • Just always prefer either of the two PTYs in the case of a race
  • Abandon the double-pty line buffering and just use a singular pty (this prevents the nice (O) and (E) division)
  • Patch the kernel to allow unbuffered, blocking writes on PTYs (maybe something like flock that forces blocks)
  • Try to make it as fast as possible to print faster than writing happens, to minimize conflicts

I added a flag, --kernel-order that just uses a singular PTY.

There's several conditions in which this is racy. Specifically, when a program writes large amounts into both STDOUT and STDERR, poll will return 2 (data is available on both PTYs), and I have no way of telling them apart. I am using two PTYs to do the fancy splitting between STDOUT and STDERR. If I abandon this feature, I can just let the kernel sort out the ordering. I have several choices here: - Rewrite this using ptrace (has its own downsides due to ptrace limitations) - Just always prefer either of the two PTYs in the case of a race - Abandon the double-pty line buffering and just use a singular pty (this prevents the nice (O) and (E) division) - Patch the kernel to allow unbuffered, blocking writes on PTYs (maybe something like flock that forces blocks) - Try to make it as fast as possible to print faster than writing happens, to minimize conflicts I added a flag, `--kernel-order` that just uses a singular PTY.
itycodes referenced this issue from a commit 3 weeks ago
itycodes referenced this issue from a commit 3 weeks ago
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: itycodes/stdgather#1
Loading…
There is no content yet.