-
Notifications
You must be signed in to change notification settings - Fork 818
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
0.14: IllegalReferenceCountException: refCnt: 0 #573
Comments
Ok, I can reproduce it:
I noticed it doesn't happen when using
|
Do I understand the idea behind the ByteBuf correct in that a method that receives or creates a ByteBuf should either
And if the method passes it on more than once, it should retain it for each case? If that is how it should work, I can see if I can find the missing call to retain() or release() |
The main place where ByteBufs were not released was the inflightWindow. Also improves two postoffice methods that passed the payload and retain information twice, once direct and once in the message.
I think PR #576 fixes the ByteBuf retain/release problems. One of the most important ones was the inflightWindow messages that were not released and retained properly. Of course, these fixes affected lots of tests that played loose with the buffers too. |
PR #464 partially fixed the problem and also adds a test, but that test never runs, because the name of the class the test is in does not end with |
The reasoning on buffer
|
As you suggested I think the problem rise when a moquette/broker/src/main/java/io/moquette/broker/Session.java Lines 241 to 245 in f6f3f6e
In this case the moquette/broker/src/main/java/io/moquette/broker/Session.java Lines 307 to 308 in f6f3f6e
payload is invalid because reached 0 refCount in the previous send.
The solution could be to handle correctly the insertions/removes into |
This problem could also happen for Qos2 processing, because also that uses the |
The main place where ByteBufs were not released was the inflightWindow.
By the way, those other PRs will probably need to be rebased as well, once you get to them. Since all these fixes are on a relatively small section of the code, it's impossible to have the commits not influence each other. |
I've rebased the other PRs. These three are directly related to this issue:
|
- Add unit test to check a second publish is sent if the not PUBACK is received in `FLIGHT_BEFORE_RESEND_MS` interval. - Fixed ServerLowLevel tests not running. * Added a test for #573
Moved buffer release/retain calls to the outside interfaces of moquette.
Moved buffer release/retain calls to the outside interfaces of moquette.
This one is probably hard to track down. I've only seen it happen once in the last few days.
It did cause the connection to the client to be dropped.
I'm currently using the in-memory persistence store.
Expected behavior
No Exceptions
Actual behavior
Steps to reproduce
See below
Minimal yet complete reproducer code (or URL to code) or complete log file
None yet
Moquette MQTT version
0.14 (with the patches from #568, #570, #572)
JVM version (e.g.
java -version
)OpenJDK 11
OS version (e.g.
uname -a
)Linux / Docker openjdk:11
The text was updated successfully, but these errors were encountered: