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

Question: Why is MemoryFileUpload not released by DefaultHttpDataFactory? #8640

Open
jameskleeh opened this issue Dec 7, 2018 · 8 comments

Comments

@jameskleeh
Copy link
Contributor

Expected behavior

I expect any MemoryFileUploads to be released when any of the cleanAll methods are called

Actual behavior

Mixed and Disk uploads are cleaned, but memory isn't. This seems intentional as the same logic is applied to attributes.

The upload/attributes are never added to the list that gets iterated over when cleaning

https://github.com/netty/netty/blob/4.1/codec-http/src/main/java/io/netty/handler/codec/http/multipart/DefaultHttpDataFactory.java#L245

Netty version

4.1.30

JVM version (e.g. java -version)

Java 8

OS version (e.g. uname -a)

macOS

@jameskleeh jameskleeh changed the title Question: Why is MemoryFileUpload is not released by DefaultHttpDataFactory? Question: Why is MemoryFileUpload not released by DefaultHttpDataFactory? Dec 7, 2018
@normanmaurer
Copy link
Member

@jameskleeh sorry for the late response... This may be a bug. Are you interested in providing a PR ?

@jameskleeh
Copy link
Contributor Author

@normanmaurer Sure thing

@jameskleeh
Copy link
Contributor Author

@normanmaurer Done #9672

@fredericBregier
Copy link
Member

@jameskleeh Indeed, that was intentional. Maybe wrongly, since you feel it should be included...
Your PR seems OK to change the behavior, but could you also fix the comments on the related "clean" methods, such that it does not explicitely stands for "disk" only (or mixed so mixed too) HttpData ?

@jameskleeh
Copy link
Contributor Author

@fredericBregier Sure thing

@jameskleeh
Copy link
Contributor Author

@fredericBregier I don't see what comments you are referring to. Can you point me in the right direction?

@fredericBregier
Copy link
Member

Sure:


(even if this one was already wrong, since in AbstractMemoryHttpData, the delete method indeed call release on bytebuf)

I don't go everywhere, but I think this are the main ones.

Of course, we might also add a new method clean duplicate of :


since it now will delete all, even not files, in order to be clean (even if cleanFile will delete all). Or just changing the associated comment to ensure the new behavior is understood.
And same on

@jameskleeh
Copy link
Contributor Author

I've updated the Javadocs to what makes sense to me. I didn't add clean methods because I don't know your preferences on default methods for backwards compatibility and deprecation. That seems out of scope for this issue anyways.

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 a pull request may close this issue.

3 participants