code: @SuppressWarnings({"unchecked", "rawtypes"})
      protected void markWritesBroken(Throwable cause) {
          if (writesBrokenUpdater.compareAndSet(this, 0, 1)) {
              if(UndertowLogger.REQUEST_IO_LOGGER.isDebugEnabled()) {
                  UndertowLogger.REQUEST_IO_LOGGER.debugf(new ClosedChannelException(), "Marking writes broken on channel %s", this);
              }
              handleBrokenSinkChannel(cause);
              safeClose(channel.getSinkChannel());
              synchronized (this) {
                  for (final S channel : pendingFrames) {
                      channel.markBroken();
                  }
                  pendingFrames.clear();
                  for (final S channel : newFrames) {
                      channel.markBroken();
                  }
                  newFrames.clear();
                  for (final S channel : heldFrames) {
                      channel.markBroken();
                  }
                  heldFrames.clear();
              }
          }
      }
docs: Called when a sub channel fails to fulfil its contract, and leaves the channel in an inconsistent state.
  <p>
  The underlying channel will be closed, and any sub channels that have writes resumed will have their
  listeners notified. It is expected that these listeners will then attempt to use the channel, and their standard
  error handling logic will take over.
  
  @param cause The possibly null cause