Skip to content

Don't corrupt response stream on GET_Value errors - #449

Open
mattjala wants to merge 1 commit into
HDFGroup:masterfrom
mattjala:fix/get-value-stream-error-handling
Open

Don't corrupt response stream on GET_Value errors#449
mattjala wants to merge 1 commit into
HDFGroup:masterfrom
mattjala:fix/get-value-stream-error-handling

Conversation

@mattjala

Copy link
Copy Markdown
Contributor

GET_Value calls resp.prepare() before fetching any data, so a 200 and the transfer-encoding headers are already on the wire by the time getSelectionData() runs. So even if the outer handler ends up with e.g. an internal server error, that status line just gets written into the body.

This can result in odd errors like:
InvalidChunkLength(got length b'HTTP/1.1 500 Internal Server Error\r\n')
which hides the underlying problem.

The paginated path in the same handler, and POST_Value, already work around this. We just need to do the same thing in GET_Value.

Both handlers also reported the traceback via print(), so it went to stdout instead of the log file.

GET_Value calls resp.prepare() before fetching any data, so a 200 and the
transfer-encoding headers are already on the wire by the time
getSelectionData() runs. So even if the outer handler ends up with e.g.
an internal server error, that status line just gets written into the body.

This can result in odd errors like:
    `InvalidChunkLength(got length b'HTTP/1.1 500 Internal Server Error\r\n')`
which hides the underlying problem.

The paginated path in the same handler, and POST_Value, already work around this.
We just need to do the same thing in GET_Value.

Both handlers also reported the traceback via print(), so it went to stdout
instead of the log file.
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 this pull request may close these issues.

1 participant