What's new

Solved Displayed memory usage error in WebUI

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Maloon

Regular Contributor
Hello,

Memory stats are not showed properly in webUI when a big SWAP file is used:

Captura de pantalla 2021-12-13 a las 12.14.37.png


Captura de pantalla 2021-12-13 a las 12.21.40.png


I hope this could be fixed.
Many thanks.
 
You have to provide more info about your environment.
 
What do you want to know?
 
10GB of swap. It is not too big, yes. But it is enough to see that memory stats are not showed properly. Reflashing did not fix anything. Issue is tested too with a RT-AX68U, with same result.
 
What are you running on this poor router that needs 10GB swap?
 
I personally don't consider that a RT-AX88U is a poor router.
 
As Router - no. As something else - yes. What you torture the tiny router hardware with?
 
I can confirm this behaviour on my RT-AX86U. It looks like overflow issue in mem_stats_arr.

But in all honesty a 10GB swap file is too large. If you actually had processes running that used that amount of swap the router would grind to a standstill. Use something more reasonable like 2GB and the cosmetic error in the GUI will disappear. If you actually need 10GB of virtual memory I think you need to reevaluate what you're doing with the router.
 
I was only reporting an issue. I don't need 10GB of swap, but it is better to have more than needed.
 
I know my hardware is more than needed, and hardware needs do not make sense with this issue, since it is a firmware issue and not a hardware issue.
 
I think I have a suspicion as to the cause.

Can you try running the following program on your router, and post the results?


Thanks.
 
I think I have a suspicion as to the cause.

Can you try running the following program on your router, and post the results?


Thanks

Hello,

This is the result. It looks fine:

Captura de pantalla 2021-12-14 a las 9.25.43.png


Many thanks.
 
By comparison, using a 1GB swap file gives:
Code:
# ./test-swap
unit_size: 1 - total swap: 1073737728
 
@RMerlin This is still not working on 386.4 / RT-AX86U.

Looks like the total size is being stored in a 32 bit variable and is overflowing.

With 5GB swap file:
Code:
# free
             total       used       free     shared    buffers     cached
Mem:        934032     903232      30800       2328        560     554236
-/+ buffers/cache:     348436     585596
Swap:      5242876          0    5242876
Code:
# cat /proc/meminfo | grep -i swap
SwapCached:            0 kB
SwapTotal:       5242876 kB
SwapFree:        5242876 kB
Code:
# /mnt/ClickUSB1/ASUS/test-swap
unit_size: 4096 - total swap: 1310719
Untitled.png
 
Last edited:
Looks like the total size is being stored in a 32 bit variable and is overflowing.
It's not that simple, as I don't store it anywhere, it's directly manipulated as a float, and sent as text to the web page:

Code:
                        sprintf(result,"%.2f",(sys.totalswap * sys.mem_unit / (float)MBYTES));

The original bug was that the value wasn't multiplied by the unit size value (in your test, multiplying both values would give you 5 GB). If it still has issues reporting large values, then it's something else causing the whole calculation to fail (and it would be specific to ARM, as I couldn't reproduce the issue on a test case compiled for x86).
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top