Skip to content

Correctly clean up memory attributes and file uploads - #9672

Closed
jameskleeh wants to merge 4 commits into
netty:4.1from
jameskleeh:memory_data_clean
Closed

jameskleeh wants to merge 4 commits into
netty:4.1from
jameskleeh:memory_data_clean

Conversation

@jameskleeh

Copy link
Copy Markdown
Contributor

Motivation:

To ensure memory attributes and file uploads are cleaned up properly

Modification:

Modified the data factory to correctly clean up memory uploads and attributes, as well as refactored the methods to ensure something like this is less likely to happen again.

Result:

Fixes #8640.

@netty-bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

@normanmaurer

Copy link
Copy Markdown
Member

@netty-bot test this please

@fredericBregier fredericBregier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK for me

@normanmaurer

Copy link
Copy Markdown
Member

@netty-bot test this please

@jameskleeh

Copy link
Copy Markdown
Contributor Author

Fixed tests

@normanmaurer

Copy link
Copy Markdown
Member

@netty-bot test this please

@normanmaurer

Copy link
Copy Markdown
Member

@jameskleeh @fredericBregier seeing that we need to adjust tests I now wonder if it may break some users code :/ ?

@fredericBregier

Copy link
Copy Markdown
Member

@jameskleeh @normanmaurer Indeed, I had the same in my mind...

Previously, any HttpData should be released once used (as any ByteBuf should be), but a specific cleanup was done on "file" data, in order to keep disk usage under control.
The new idea was to add the "memory" too to this cleanup. But it seems it brings some issues. I was believieng that it shall not raised any issue since call twice the release on HttpData will not release twice the ByteBuf. But the changed tests seem to show the contrary.

In order to keep the previous orientation, we might introduce 2 things:

  • one additional list that keep trace of all HttpData, whatever disk based or memory based
  • one additional method to clean everything, based on this new list

Doing this will preserve the previous semantic, but still having the possibility to clean all and everything if needed.

WDYT?

@jameskleeh

Copy link
Copy Markdown
Contributor Author

I think if another method is introduced for this, that method should be deprecated in the next major release and the existing methods should be changed. Just let me know how you all want to proceed

@fredericBregier

Copy link
Copy Markdown
Member

@jameskleeh Changing to deprecated to removal is a long way (depends on what is a major version of course).
I believe it is difficult to add a new method that is from the beginning "deprecated". From an external point of view, it seems strange (even if I understand the reason why and seems correct).
Maybe adding the new method with a warning on both previous methods (those not taking care of "memory" HttpData part) and the new one (explaining it extends the others temporarily, until a new major version comes out) could be enough.
@normanmaurer WDYT ?

@normanmaurer

Copy link
Copy Markdown
Member

I think this cane be closed ... Please re-open if you think I am wrong

@jameskleeh
jameskleeh deleted the memory_data_clean branch July 13, 2021 19:25
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.

Question: Why is MemoryFileUpload not released by DefaultHttpDataFactory?

4 participants