core icon indicating copy to clipboard operation
core copied to clipboard

Dashboard - fails to load on multilple instances

Open dwkirw opened this issue 1 year ago • 14 comments

  • [x] I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
  • [x] I am convinced that my issue is new after having checked both open and closed issues.

Describe the bug

Most dashboard widgets revert to 'Failed to Load widget' in the event that multiple sessions to the dashboard are open.

To Reproduce

View the Dashboard in a browser. Simultaneously view the Dashboard in another browser or from another device / mobile device.

Expected behavior Dashboard would remain operational on both browser sessions.

Software version used and hardware type if relevant, e.g.:

OPNsense 24.7 (amd64). Intel® Xeon™ E3-1225V5 3.3Ghz Quad Core Network Intel® I210-AT

dwkirw avatar Jul 26 '24 05:07 dwkirw

This https://github.com/opnsense/core/commit/724f8494d64074e0384b9f593e699daf2d84d604 should improve the situation, but is not the complete fix (it needs some safety fences as well).

You can apply the patch and restart the webserver using:

opnsense-patch 724f8494d
configctl webgui restart

Leaving the ticket open.

AdSchellevis avatar Jul 26 '24 06:07 AdSchellevis

Nice work thank you!

dwkirw avatar Jul 26 '24 07:07 dwkirw

This patch fixed it for me as well. Had no idea you could do patches like that in opnsense what an amazing project.

awptechnologies avatar Jul 27 '24 15:07 awptechnologies

Unfortunately the patch only helps when initially restarting the web service, and only with a few widgets. Very soon after the service is restarted, widgets fail to load again. With a large number of widgets (13 in my case) many do not load even after restarting the web service. I've added a CPU but that doesn't appear to have helped. I can try adding memory but it's only using 969MB of 4GB.

kronenpj avatar Jul 28 '24 15:07 kronenpj

Maybe this helps, but I don't know the implications:

https://forum.opnsense.org/index.php?topic=41729.msg205557#msg205557

Monviech avatar Jul 28 '24 15:07 Monviech

That helped a lot. The value of 10000 (ms) in /usr/local/opnsense/www/js/widgets/BaseWidget.js might be a little high - mine are responding within about 1500ms so, for me, a good value is 2000.

As far as implications of a longer timeout, I could see, from an operational firewall perspective, if the UI makes multiple requests when there are outstanding requests that haven't timed out, it would result in resource starvation. Whether that would affect the operation of the firewall or just the webgui service, I do not know.

kronenpj avatar Jul 28 '24 15:07 kronenpj

Perhaps making it configurable would be a good idea, I doubt we'd reach some consensus about which value is good considering all the factors involved., However, the currently hardcoded 1000ms clearly is not a good one.

doktornotor avatar Jul 28 '24 16:07 doktornotor

I am still having issues with the services widget. It loads on refresh and dissapear with the errors after about 10 seconds

awptechnologies avatar Jul 29 '24 06:07 awptechnologies

Maybe this helps, but I don't know the implications:

https://forum.opnsense.org/index.php?topic=41729.msg205557#msg205557

Setting the value mentioned in the link to 2000 fixed the issue for me as well. Probably because this is a slower system.

EDIT: the patch proposed by @AdSchellevis was not required.

Stricken1670 avatar Jul 29 '24 10:07 Stricken1670

@AdSchellevis's patch fixes the problem when too many requests are made in parallel, like when you have more than one dashboard open or or many widgets are active. The increased timeout helps with slow CPUs, so both changes are helpful.

meyergru avatar Jul 29 '24 10:07 meyergru

For reference: https://github.com/opnsense/core/commit/973e744fb

fichtner avatar Jul 29 '24 10:07 fichtner

Last Patch fixed it.

awptechnologies avatar Jul 31 '24 04:07 awptechnologies

I don't know if its related but os-dmidecode doesn't show in the new dashboard widget selections.

awptechnologies avatar Jul 31 '24 04:07 awptechnologies

no it doesn't os-dmidecode doesn't ship a new style widget, I don't think there is an active maintainer for the plugin.

AdSchellevis avatar Jul 31 '24 06:07 AdSchellevis