Commit Graph

1068 Commits

Author SHA1 Message Date
Martin Bogomolni 9f3446b605 feat: Implement comprehensive memory management and stability improvements
🔧 Memory Management Enhancements:
- Add memory cleanup constants (MAX_CMD_HISTORY=1000, MAX_SEEN_NODES=500, MAX_MSG_HISTORY=100)
- Implement cleanup_memory() function to prevent unbounded list growth
- Add periodic cleanup every hour via watchdog process
- Clean up stale game tracker entries automatically
- Limit cmdHistory and msg_history sizes to prevent memory bloat

🚀 Async Task Management Improvements:
- Fix async task management in both mesh_bot.py and pong_bot.py
- Implement proper task cleanup and cancellation on shutdown
- Add task names for better debugging and monitoring
- Use asyncio.gather() with return_exceptions=True for better error handling
- Prevent task hanging and resource leaks

🛡️ Enhanced Resource Management:
- Improve exit_handler() with proper interface cleanup
- Add atexit.register() for automatic graceful shutdown
- Ensure all meshtastic interfaces are properly closed
- Save persistent data (BBS, email, SMS, game scores) on exit
- Perform final memory cleanup during shutdown

🔍 Better Exception Handling:
- Replace bare except: blocks with specific exception handling
- Add proper error logging throughout the codebase
- Improve BBS database operations with better error recovery
- Add try/catch blocks for file operations and imports

📈 System Stability Improvements:
- Prevent memory leaks from growing lists and dictionaries
- Add automatic cleanup of stale player tracking data
- Improve error recovery in watchdog and async loops
- Better handling of interface connection failures

These changes address critical memory management issues that could cause
the bot to consume increasing memory over time, eventually leading to
system instability. The improvements ensure long-term reliability and
better resource utilization.

Fixes: Memory leaks, async task hanging, resource cleanup issues
Improves: System stability, error handling, resource management
Tested: Code analysis and review completed
2025-10-05 23:45:40 -07:00
SpudGunMan 4e074a309f Update system.py 2025-10-05 23:05:55 -07:00
SpudGunMan f394f58b9f paxCounter 2025-10-05 22:30:03 -07:00
SpudGunMan 5c54ce0b70 better waypoint data 2025-10-05 21:50:56 -07:00
SpudGunMan b4684f49ff Update system.py 2025-10-05 21:38:19 -07:00
SpudGunMan c6c1e9f637 refactor more consumeMetadata 2025-10-05 21:13:39 -07:00
SpudGunMan 006c9f58c6 enhance bbsLink 2025-10-05 19:44:00 -07:00
SpudGunMan 3d582e9b77 enhance import of BBS
for ssh copy
2025-10-05 19:20:44 -07:00
SpudGunMan 0578c0b233 more enhancing metadata 2025-10-05 19:00:34 -07:00
SpudGunMan 98ccf8708f enhanceTelemetry
logging and handlers for telemetry
2025-10-05 17:47:19 -07:00
SpudGunMan 47280f4330 Update bbstools.py
comment from https://github.com/SpudGunMan/meshing-around/issues/194
2025-10-05 15:26:50 -07:00
SpudGunMan 4b0b074ba7 mathWasntMathn'
@mesb1 thanks
2025-10-05 09:08:47 -07:00
SpudGunMan 1a49a81cf5 load_bbsdb with 'api'
allows for ssh file synch?
2025-10-04 12:54:20 -07:00
SpudGunMan c51a4584ae enhance bbsAPI
switch for diskIO
2025-10-03 19:06:14 -07:00
SpudGunMan 13ee6d4fd6 enhance bbsDM
enable a new 'API' to inject into the pkl file for DM's also see https://github.com/SpudGunMan/meshing-around/commit/2d44faac98bb977d9b3b9f840ca4dfbec71af3dc
2025-10-03 19:02:15 -07:00
SpudGunMan 0a2daeac1f Update joke.py 2025-10-03 15:42:05 -07:00
SpudGunMan da7ba256d8 Update joke.py 2025-10-03 15:41:40 -07:00
SpudGunMan 42e99a0dc1 Update joke.py 2025-10-03 15:40:54 -07:00
SpudGunMan ca5896a015 Update locationdata.py 2025-10-03 15:35:04 -07:00
SpudGunMan 9d080de8f3 Update locationdata.py 2025-10-03 15:01:41 -07:00
SpudGunMan 6439f49fb1 Update filemon.py 2025-10-03 12:28:47 -07:00
SpudGunMan c115cdf82f enhance x: with subprocess 2025-10-03 12:15:14 -07:00
SpudGunMan c23564d8b5 Update system.py 2025-10-02 19:37:57 -07:00
SpudGunMan 1aa4eddb3b Update filemon.py 2025-10-02 19:07:37 -07:00
SpudGunMan a7de64b385 Update filemon.py 2025-10-02 19:03:15 -07:00
SpudGunMan 2e8206d4ec x:ShellCommands
this x: is a direct shell access from DM, to enable it needs the enable_runShellCmd, allowXcmd, xcmdChannel set. Make sure your secure.
2025-10-02 18:58:27 -07:00
SpudGunMan b47c13503b Update filemon.py 2025-10-02 13:37:17 -07:00
SpudGunMan 02322cdf91 cleanup
fixes per https://github.com/SpudGunMan/meshing-around/issues/192
2025-10-02 04:51:40 -07:00
SpudGunMan 955d3681e9 Update joke.py 2025-10-01 11:41:59 -07:00
SpudGunMan b53a7d3832 Update joke.py 2025-09-29 16:13:01 -07:00
SpudGunMan 6e3d83401f enhance echo
enhance echo
2025-09-28 16:28:31 -07:00
SpudGunMan f9ab6a79d3 echo
echo command will just echo, off by default its handy for things like making a demo or node speak
2025-09-28 15:04:56 -07:00
SpudGunMan 4b2402c286 Update space.py 2025-09-27 17:24:21 -07:00
SpudGunMan 47e0276f0c howtall
returns height of something you give a shadow by using sun angle
2025-09-26 19:23:12 -07:00
SpudGunMan 6dc54abf43 enhance 2025-09-26 19:16:16 -07:00
SpudGunMan 53ff37c782 howtall
is this handy? I thought it might be for tree tower use
2025-09-26 19:02:02 -07:00
SpudGunMan 5c48e008ee Update checklist.py 2025-09-26 19:00:46 -07:00
SpudGunMan 507919bb4c aarg 2025-09-26 16:05:55 -07:00
SpudGunMan aa051abbd4 better Logic for handler 2025-09-26 15:54:51 -07:00
SpudGunMan 8ba0c6f14c Update system.py 2025-09-26 15:47:51 -07:00
SpudGunMan adb6fa3b5a Update system.py 2025-09-26 15:36:49 -07:00
SpudGunMan a9254c9c79 addFav
Helper Script to Add Favorite to the bot node for admin and other use
2025-09-26 15:32:24 -07:00
SpudGunMan ec24a8b8dd typo 2025-09-24 15:19:57 -07:00
SpudGunMan f79026a95f enhance
DEBUGpackets, debugMetadata hidden config.ini values
2025-09-24 15:16:37 -07:00
SpudGunMan 99acaf28a1 Update system.py 2025-09-24 15:14:17 -07:00
SpudGunMan 9c068c8d28 Update settings.py 2025-09-24 15:14:07 -07:00
SpudGunMan d9ab1b88c1 Update system.py 2025-09-24 15:10:26 -07:00
SpudGunMan ea47bf9329 bugfix parser
thanks again Iris!
2025-09-19 09:32:53 -07:00
SpudGunMan 229043c32a fix config.ini bug
Thanks Iris for pointing out this long time bug
2025-09-19 09:05:37 -07:00
SpudGunMan 5dbd137f14 enhance 2025-09-19 08:51:43 -07:00