-
Notifications
You must be signed in to change notification settings - Fork 48
Usage report zip file creation throws System.ObjectDisposedException: Cannot access a closed Stream #5029
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
Conversation
|
@johnsimons I haven't had a chance to test this yet but given the argument in the previous PR was that reports can be rather large, would it be worthwhile trying to directly compress into the output? Also, there appears to be no test coverage for this controller action, which means some manual testing is required. |
|
I'm not sure that there is anything to be gained with this approach, as there is evidence that FileStreamResult is optimized for large files. Simply using a zip file in the first place to compress the result seems good enough. Manually manipulating the response stream seems like it could be error prone (see drawbacks section) if things change. |
|
@awright18 I think what is missing in the comment you made is that the current approach first zips everything into memory and then streams that back. The "benefit" of this approach would be
but I'm not an expert enough in ASP.NET Core to judge whether this is feasible. I have setup an instance to test it. |
johnsimons
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense @danielmarbach.
TBH, I just copy/pasted the first example I found, and did not really think much about it given this functionality should be only used once a year.
38bcc15 to
db8c13f
Compare
|
Manually tested with RabbitMQ. |
Symptoms
Version 6.7.0 introduced a bug, preventing customers from downloading the useage report.
Who's affected
Anyone using 6.7.0.
Root cause
The previous PR did introduce a problem because the memory stream was disposed before the response was copied which led to the following exception
Work done
Fix and improvements for #4971
This switches over to directly write to the output stream writer which bypasses the memory stream making things more efficient from a memory perspective but also addressing the previous problem. It would have been possible to remove the dispose on the memory stream and ship that as a patch too but given I already had this improvement lined up I figured I also test this one which made me discover the original problem