buf_flush_to_tls: Non-fatal assertion !(flushlen > *buf_flushlen)

Had this on my relay because I ran out of disk space due to debug.log being on.

Nov 05 12:39:01.801 [warn] tor_bug_occurred_(): Bug: src/lib/tls/buffers_tls.c:152: buf_flush_to_tls: Non-fatal assertion !(flushlen > *buf_flushlen) failed. (Future instances of this warning will be silenced.) (on Tor 0.4.3.0-alpha-dev 4413b98190d94b54)

So the code that exploded is:

  if (BUG(flushlen > *buf_flushlen)) {
    flushlen = *buf_flushlen;
  }

It was triggered by lack of disk space for sure.

The only thing I can see is if connection_handle_write_impl() was called with force = 1 which happens with connection_flush() which makes tor use the bucket limit instead of the outbuf "flushlen" and thus could lead to that assert().