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

Error only in Chrome: Cannot access a closed Stream #50

Closed
krusoleo opened this issue Feb 19, 2019 · 6 comments
Closed

Error only in Chrome: Cannot access a closed Stream #50

krusoleo opened this issue Feb 19, 2019 · 6 comments

Comments

@krusoleo
Copy link

We experience the following error when accessing images in the Google Chrome browser (only in Chrome), and not on all machines, which makes it difficult to reproduce and debug.
When disabling Dianoga the error goes away.
I am curious if anybody else has seen this.
Any tip on where to look to debug/solve this would be greatly appreciated.
Here is the full stack trace:

Cannot access a closed Stream.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ObjectDisposedException: Cannot access a closed Stream.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ObjectDisposedException: Cannot access a closed Stream.]
System.IO.__Error.StreamIsClosed() +59
System.IO.MemoryStream.get_Length() +30
Sitecore.Resources.Media.Streaming.RangeRetrievalResponse.WriteFullContent(HttpContext context, Stream fileContent) +105
Sitecore.Resources.Media.MediaRequestHandler.DoProcessRequest(HttpContext context, MediaRequest request, Media media) +451
Sitecore.Resources.Media.MediaRequestHandler.DoProcessRequest(HttpContext context) +1574
Sitecore.Resources.Media.MediaRequestHandler.ProcessRequest(HttpContext context) +57
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +790
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +88

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3282.0

@krusoleo
Copy link
Author

I found out that we were using the sync setup with Dianoga.Strategy.GetMediaStreamSync.config and it seems to be the cause for the error.
I reverted to the async setup and the error is gone.
So there might be a small bug with the sync setup in Chrome.

@markgibbons25
Copy link
Collaborator

markgibbons25 commented Feb 20, 2020

This should be fixed now https://github.com/kamsar/Dianoga/releases/tag/5.0.0-beta.1 please can you retest?

@hardboilr
Copy link

We're running version 5.0.0-rc.4 and are still experiencing above issue on Azure Webapps. Issue is there on both sync and async configurations.
No issues whatsoever when running same code on VMs.

@markgibbons25 markgibbons25 reopened this Mar 19, 2020
@markgibbons25
Copy link
Collaborator

Hi @hardboilr I have tested this on webapps across browsers and havent seen this issue. So I would lean towards it being a particlar image or particular set of query strings in this scenario. Can you possibly attach the original image and the query string that is being used?

@hardboilr
Copy link

@markgibbons25 : Sorry for not getting back to you. We've been extremely busy due to the covid-19 situation. Have upgraded to latest 5.0.0-rc.6 and will test again and get back to you.
FYI: I don't know if this is still an issue with version 5, but it has been necessary to patch the optimizers' "GetTempFilePath" as the webapp doesn't have write/(possibly read also)-permission to the tmp-location you resolve to by default. As we're running on Sitecore, I've changed the file location to something inside the current iis-site, where the webapp have the necessary permissions.

@markgibbons25
Copy link
Collaborator

Hi @hardboilr I think I may have spoken to a colleague of yours on sitecore slack about this. It shouldn't be necessary to patch that path on Azure Webapps any more and I would urge you to use the latest 5.0 RC. I am closing this issue, please open a new one if this does not work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants