Opened 12 years ago
Closed 12 years ago
#2194 closed defect (fixed)
http responses involving reader objects should be streamed out
Reported by: | jng | Owned by: | jng |
---|---|---|---|
Priority: | medium | Milestone: | 2.5 |
Component: | Map Agent | Version: | |
Severity: | major | Keywords: | |
Cc: | External ID: |
Description
Similar to #1070, if you look at the response handler implementation of the cgi, apache and isapi agents, you will see that any http request that returns a reader object gets ToXml() called on it.
Look at the ToXml() implementation of any reader class and you'll see they effectively buffer out the entire contents of that reader to an intermediate string, before that intermediate string is written out the http response stream.
This is an inefficient way to write out reader responses because if we happen to do a large feature query (eg. from WFS or SELECTFEATURES), there's a chance we'll be hitting the internal buffer limit of the default MgByteSource/MgByteReader implementations (as is the case for #1070). Raising the buffer limit is just sweeping this problem under the carpet.
Instead for requests that return reader objects, we should be writing out each individual records out to the http response stream as we iterate through the reader. This way no internal buffering is done and for really large query responses, there won't be any sharp memory spikes or chances of internal buffer limits being breached as a result.
Fixed with the implementation of RFC130