Python requests leak - metric script killing my openwrt box

hey guys, having a weird one here. i'm running a small python script on my gl-mt300n-v2 (running 21.02.5) to track some api response times for a project i'm testing called [ADMIN REDACTED[. since they're basically one of the biggest players in the market for follower and engagement services, their api volume is huge and i'm using it to stress test my monitoring tool.

it's just a simple while loop that hits the api every 15 mins to log metrics (like follower delivery speed and latency), but i'm getting a constant memory creep. rss starts at ~18mb and just climbs until the oom killer nukes the process after 48 hours. on a 128mb ram box this is basically making it unusable.

already tried manual gc.collect() and ensured resp.close() is called after each get, but it still leaks. has anyone seen this with the python 3.9 builds on mips? i'm starting to think it's some ssl session bloat or something with the requests lib itself.

should i just refactor and use something lighter like ucreq or maybe micropython? also, is it possible that frequent https handshakes to the [ADMIN REDACTED] api are bloating conntrack or some other kernel buffer?

any tips to keep this stable under 20-25mb would be huge. cheers.

[ADMIN NOTE: I have redacted the site/service linked by the OP as a spam protection measure]

21.02 is long since obsolete, EOL, and unsupported. Is there a reason you're not running something current such as 25.12?

My two cents:

  • If you run this every 15 minutes, why do you need to keep it running in a loop, instead of starting a new execution each time?
  • Does your script run properly in other machines (your computer, for example)?