The stream channel updates its writability manager when issuing a write to the parent channel and when the write promise has been succeeded. If the write promise has already been succeeded then the writability manager can be updated in the wrong order which can lead to underflow.
Modifications:
Use signed arithmetic in the writability manager and allow pending
bytes to become (briefly) negative.
Result:
The writability manager's pending bytes shouldn't underflow.
Motivation:
The stream channel updates its writability manager when issuing a write to the parent channel and when the write promise has been succeeded. If the write promise has already been succeeded then the writability manager can be updated in the wrong order which can lead to underflow.
Modifications:
Result:
The writability manager's pending bytes shouldn't underflow.