Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Queue full #50

Open
rohithbv1991 opened this issue Aug 31, 2018 · 7 comments
Open

java.lang.IllegalStateException: Queue full #50

rohithbv1991 opened this issue Aug 31, 2018 · 7 comments

Comments

@rohithbv1991
Copy link

java.lang.IllegalStateException: Queue full
    at java.util.AbstractQueue.add(AbstractQueue.java:98)
    at com.github.brainlag.nsq.Connection.incoming(Connection.java:115)
    at com.github.brainlag.nsq.netty.NSQHandler.lambda$channelRead0$3(NSQHandler.java:41)
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
    at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
    at java.lang.Thread.run(Thread.java:748)

Went through the code and found the following line in Connection.java :

private final LinkedBlockingQueue<NSQFrame> responses = new LinkedBlockingQueue<>(1);

Wanted to understand why this is initialized with capacity 1 and what could potentially be causing this error. Could it be related to high rate of polling NSQ? We deal with a lot of data.

@yyqian
Copy link

yyqian commented Nov 6, 2018

Same here.

I find this problem is caused by the 'no-waiting' command and ErrorFrame processing logic

For example:

If I call FIN command multiple times, nsqd will response "E_FIN_FAILED FIN 0a8c981c6da8c000 failed ID not in flight"

The problem is:

  1. the FIN command is sent but not waiting for response
  2. Read Channel received ErrorFrame, this frame is added to responses queue, but no consumer is waiting on this queue
  3. if 1 and 2 happens again, the responses queue is overflow
connection.command(NSQCommand.finish(this.id))
public ChannelFuture command(final NSQCommand command) {
        return channel.writeAndFlush(command);
}
        if (frame instanceof ErrorFrame) {
            if (errorCallback != null) {
                errorCallback.error(NSQException.of((ErrorFrame) frame));
            }
            responses.add(frame);
            return;
        }

@guptaaditya13
Copy link

@rohithbv1991 I was facing the same issue again, I tracked it and read the the whole source code then came here to raise the issue and found this. 😂

@creepyghost
Copy link

Faced the same problem. It crashes after the second timed out message.

Relevant XKCD

@pranavanurag
Copy link

hello i'm here too now

@curefit-aditya-gupta
Copy link

Go to RabbitMQ, NSQ is dead.

@yuexinok
Copy link

yuexinok commented Jul 7, 2020

Connection

I met too,because message.finished() Execute many times

@cssword
Copy link

cssword commented Dec 10, 2020

This forked from nsqio/TrendrrNSQClient , and in that project,

responses.add(frame);

has been replaced by

responses.offer(frame,1,...);

Hope help anyone.

yuexinok added a commit to ec-web/JavaNSQClient that referenced this issue Dec 29, 2020
修复 Queue full错误
brainlag#50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants