I haven’t looked at the Mina code in a while. Looking at DefaultIoFilterChain.java under HeadFilter#filterWrite
WriteRequestQueue writeRequestQueue = s.getWriteRequestQueue(); if (!s.isWriteSuspended()) { if (writeRequestQueue.isEmpty(session)) { // We can write directly the message s.getProcessor().write(s, writeRequest); } else { s.getWriteRequestQueue().offer(s, writeRequest); s.getProcessor().flush(s); } } else { s.getWriteRequestQueue().offer(s, writeRequest); } Checking and working with the WriteRequestQueue is unnecessary because the AbstractPollingIoProcessor adds all write requests to the Queue anyway. Similarly, it is confusing that the HeadFilter is controlling the increaseScheduledWriteBytes. This should be controlled by the AbstractPollingIoProcessor to ensure safety of the increase/decrease operations. On Fri, Oct 6, 2017 at 12:05 PM, Emmanuel Lecharny (JIRA) <j...@apache.org> wrote: > > [ https://issues.apache.org/jira/browse/DIRMINA-1057?page= > com.atlassian.jira.plugin.system.issuetabpanels:comment- > tabpanel&focusedCommentId=16194776#comment-16194776 ] > > Emmanuel Lecharny commented on DIRMINA-1057: > -------------------------------------------- > > There might be a race condition, where the {{scheduledWriteMessages}} is > decremented before being incremented. > > Now this counter is not really interesting : it just count the number of > messages waiting to be sent (or fully written) to the client. Ultimately, > it should be 0 most of the time. > > > AbstractIoSession getScheduledWriteMessages always -negative? > > ------------------------------------------------------------- > > > > Key: DIRMINA-1057 > > URL: https://issues.apache.org/jira/browse/DIRMINA-1057 > > Project: MINA > > Issue Type: Bug > > Components: Core > > Affects Versions: 2.0.16 > > Environment: I'm testing slow consumer backlog detection and > while getScheduledWriteBytes() correctly grows, getScheduledWriteMessages > is always negative and does not increase. looking into code to see why but > putting bug report here as well for tracking > > Reporter: Andre Mermegas > > > > > > > -- > This message was sent by Atlassian JIRA > (v6.4.14#64029) >