Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Exception while encoding/writing view using pooled buffer #3252

Closed
GVX111 opened this issue Oct 3, 2015 · 14 comments
Closed

Exception while encoding/writing view using pooled buffer #3252

GVX111 opened this issue Oct 3, 2015 · 14 comments
Assignees
Milestone

Comments

@GVX111
Copy link

GVX111 commented Oct 3, 2015

on running controller /home/index showing this error

ArgumentException: The output byte buffer is too small to contain the encoded data, encoding 'Unicode (UTF-8)' fallback 'System.Text.EncoderReplacementFallback'.
Parameter name: bytes
System.Text.Encoding.ThrowBytesOverflow()

Error 2

Unhandled Exception: System.InvalidOperationException: A LeasedArraySegment was
collected without being returned to the pool. This is a memory leak.
   at Microsoft.Framework.MemoryPool.DefaultArraySegmentPool`1.DefaultLeasedArra
ySegment.Finalize()
@rynowak
Copy link
Member

rynowak commented Oct 4, 2015

Can you provide some more details? What platform is this on? What's your controller/view code look like?

@rynowak rynowak changed the title Bug Exception while encoding/writing view using pooled buffer Oct 4, 2015
@GVX111
Copy link
Author

GVX111 commented Oct 4, 2015

this is my view.cshtml [http://textuploader.com/av9vf]

When i removed section slider working correct.
dnx: 1.0.0-rc1-15798
platform: windows

@GVX111
Copy link
Author

GVX111 commented Oct 5, 2015

I understand problem. If i have utf8 encoded text in @section script { } than exception.

@rynowak
Copy link
Member

rynowak commented Oct 5, 2015

Working on a fix for this now - there are two issues here:

Dispose method needs to always dispose the buffers, even if flush fails

We were computing the usable size of the char buffer incorrectly. GetMaxCharCount is for decoding - what we need is a GetMinCharCount which doesn't exist. I'm changing the design a bit - now the char buffer is a fixed size, and the byte buffer must be big enough to accommodate it.

@danroth27 danroth27 added this to the 6.0.0-rc1 milestone Oct 5, 2015
@GVX111
Copy link
Author

GVX111 commented Oct 5, 2015

@rynowak thank you for reply. I'm working on this error 10 hour and i didn't fix this problem.
How many time need to fix this but?

@rynowak
Copy link
Member

rynowak commented Oct 5, 2015

If you need to have stable builds you shouldn't by using our CI packages, stick to the latest release without a build number in it (right now 'beta7') Using the latest packages means that you're going to be exposed to a lot of churn and unfortunately, sometimes breaks like this..

This will be checked in sometime this morning, and packages available when they are available.

@GVX111
Copy link
Author

GVX111 commented Oct 5, 2015

Yes i m using 6.0.0-*. I must change it t beta7?

@davidfowl
Copy link
Member

beta7 is stable so yes, beta8 will be stable soon.

rynowak added a commit that referenced this issue Oct 5, 2015
- Dispose buffers when Flush throws inside the Dispose method
- Compute size of buffers correctly
- Throw earlier when handed invalid-sized buffers
@GVX111
Copy link
Author

GVX111 commented Oct 5, 2015

Error:
Unhandled Exception: System.InvalidOperationException: A LeasedArraySegment was
collected without being returned to the pool. This is a memory leak.
at Microsoft.Extensions.MemoryPool.DefaultArraySegmentPool`1.DefaultLeasedArraySegment.Finalize()

@GVX111
Copy link
Author

GVX111 commented Oct 5, 2015

@rynowak Its same problem not fixed. I used dnu restore but same problem

@rynowak
Copy link
Member

rynowak commented Oct 5, 2015

The package for this won't be available until it has time to propagate through our CI.

@GVX111
Copy link
Author

GVX111 commented Oct 5, 2015

@rynowak thank you for help. How many time does it need?

@rynowak
Copy link
Member

rynowak commented Oct 5, 2015

This should be available now with version: 6.0.0-rc1-15986

@rynowak rynowak closed this as completed Oct 5, 2015
@rynowak
Copy link
Member

rynowak commented Oct 5, 2015

ad3c257

@rynowak rynowak added 3 - Done and removed 1 - Ready labels Oct 5, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants