Unifi binding: Unhandled exception

Hi,
I have this behaviour of the Unifi Binding. When starting it turns online for a second and then it changes to “offline communication error”.
Logfile says:

2020-02-15 15:16:05.797 [hingStatusInfoChangedEvent] - 'unifi:controller:7ef1983d' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2020-02-15 15:16:06.687 [hingStatusInfoChangedEvent] - 'unifi:controller:7ef1983d' changed from INITIALIZING to ONLINE
2020-02-15 15:16:08.611 [WARN ] [.handler.UniFiControllerThingHandler] - Unhandled exception while refreshing the UniFi Controller unifi:controller:7ef1983d - java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded
2020-02-15 15:16:08.618 [hingStatusInfoChangedEvent] - 'unifi:controller:7ef1983d' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded
2020-02-15 15:16:20.674 [WARN ] [.handler.UniFiControllerThingHandler] - Unhandled exception while refreshing the UniFi Controller unifi:controller:7ef1983d - java.lang.IllegalArgumentException: Buffering capacity 2097152 exceeded

The last message is then repeated every 10-12 seconds.

Can someone tell me how to fix this?

Jörg

Welcome to the community!

What version of OH and Unifi binding are you using? How did you install OH, what is OH running on and how long has this been happening? Also what version is the Unifi controller?

Have you tried stopping OH, cleaning the cache and rebooting?

Thanks for the fast answer,
I run a freshly installed openhabian on Raspi4.
OH: 2.5.1
Binding: binding-unifi - 2.5.1
It happened directly after install and configuration of the unifi binding.
I just stopped OH, cleaned cache and rebooted the raspi and it is just the same error.

Go to the openhbian-config tool (from command line: sudo openhabain-config), select number 10 Apply Improvements then numbers 11, 13, and 14. After that check if the error remains and restart OH if so.

If that does not fix it please set the log to DEBUG via the console and see if there is any additional info that may help. If you need help with using the console let me know.

Installed the improvements and rebooted.

Do not know if I have done that logging the right way

I stoped the service and started OH with “sudo openhab-cli start --debug”
as I could not see any debug messages I set “log:set DEBUG .handler.UniFiControllerThingHandler” but still see no DEBUG messages. Just still the same “Buffering capacity 2097152 exceeded” messages every 12 seconds.

Which UniFi controller version are you on?

The Unifi Controller is a Unifi Cloud Key running Version 5.12.35 Build atag_5.12.35_12979

You may want to follow this issue and give it a bump to see if there has been any progress.

2 Likes

@jhohn the issue @H102 sited was reason for my question. Seems we are all having some issues.

2 Likes

@Thedannymullen: I ask about the Unifi version number in my first reply but didn’t get an answer until you ask. :upside_down_face:

With all the info could have saved some time on this one. :wink:

2 Likes

Sorry and thanks for the answer.

I managed to go through the link you provided and the according forum link (Online channel not working after upgrading UniFi Controller to 5.12.35) and I do not expect this to be the same error. With the BUG you provided the link for, OH is connected to the Unifi Controller but do not update the status of channels. In my case, the connection to the controller is disruptet because of a communication error.

The error in my case says the buffer for the answer is 2MB and the answer is to large (“Buffering capacity 2097152 exceeded”) and if I try the corresponding API call “https://:8443/api/s//stat/sta” I get an answer which is 5.6MB (“5865901”).

Is there any configuration where I can enlarge the buffer size?

That would be a question for the binding developer as I do not see an option in the doc’s. :neutral_face:

1 Like

A search of the codebase did not find this message. So it may be coming from an underlying library. If you can provide the actual log message, we might be able to tell more, but I’m guessing this is not configurable.

I should’ve read up the thread further. I found the log message.
Unfortunately it doesn’t help.
Would you be interested in testing with a version with additional debug output that includes stacktraces?

Sure, will do that. If you can tell me how?

I will try to provide an updated jar for you to use tomorrow.

Here’s the jar.

Make sure to set logging for the binding to TRACE before capturing logs.

Is this going to be placed in
/var/lib/openhab2/tmp/mvn/org/openhab/addons/bundles/org.openhab.binding.unifi/
or
/srv/openhab2-userdata/tmp/mvn/org/openhab/addons/bundles/org.openhab.binding.unifi/

I assume I need to create a new folder 2.5.2 in one of the directories and put it there, is that right?

[EDIT] This buffer limit seems to be a general issue: https://github.com/openhab/openhab-addons/issues/6963 [EDIT]

Meanwhile I cleaned up my Unifi Controller Database and deleted old entries. The the binding is working. Unifi Controller is connected. API call answers are ~ 100KB
So it seems there is a problem with API call answers > 2MB

1 Like