Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUMM-610 Hotfix for memory leaks on data upload #180

Merged

Conversation

ncreated
Copy link
Member

What and why?

🐛 This hotfix is addressing #178 - where constantly growing memory usage is reported due to intensive logging.

With intensive logging comes frequent upload... and what I noticed is that every upload results with a memory leak. Here, allocations graph for 10 uploads (each batch was ~1MB):
Screenshot 2020-07-14 at 18 16 31

How?

The reason of this leak, was an internal caching applied by the URLSession - by default, the session's configuration.urlCache is not nil, which results with some representation of the URLRequest being kept in memory (together with its .httpBody):

Screenshot 2020-07-14 at 18 28 13

This started being visible after #65, where the ?batch_time= query parameter was introduced and cache keys become unique for every new request.

The fix is simple - we need to opt-out from using the .urlCache for the URLSession. After this, the allocation graph is no longer growing infinitely (same 10 batches, ~1MB each - no more "Live" blobs):

Screenshot 2020-07-14 at 18 22 47

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

Copy link
Member

@mariusc83 mariusc83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was thinking about side effects ...but as we are only posting data I guess this cannot harm us.

@ncreated ncreated changed the base branch from master to hotfix/1.2.3 July 15, 2020 09:25
@ncreated ncreated merged commit fb59e41 into hotfix/1.2.3 Jul 15, 2020
@ncreated ncreated deleted the ncreated/RUMM-610-fix-memory-leaks-in-data-upload branch July 15, 2020 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants