Skip to content

style: formalize exception policy on the data path.#4793

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
htuch:no-exceptions-data
Oct 22, 2018
Merged

style: formalize exception policy on the data path.#4793
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
htuch:no-exceptions-data

Conversation

@htuch
Copy link
Copy Markdown
Member

@htuch htuch commented Oct 19, 2018

Signed-off-by: Harvey Tuch htuch@google.com

Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Copy Markdown
Member Author

htuch commented Oct 19, 2018

@envoyproxy/maintainers

@htuch htuch requested a review from lizan October 19, 2018 20:55
Comment thread STYLE.md Outdated
static) should throw meaningful `EnvoyException`s, the configuration
ingestion code will catch these.
- To indicate constructor failure.
* Do not use exceptions on the data path for general purpose error handling.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I really agree with this. Sometimes it makes things easier, sometimes not. What's the rationale for this change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more context is here: #4707 (comment)

We need clearer guide line for using exception on data path.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main area in which exception handling is used currently on the data path is codecs/parsing which tend to have very deep call stacks, making return error handling onerous. I don't think we should prevent people from doing this since I think it's a reasonable pattern. I do agree we should make things more clear in what we expect (in general I think we expect people to not use exceptions when the error call stack is only a single call deep for example), but I would generally clarify that Envoy core will not catch any exceptions on the data path, so any not caught exception will cause the server to crash.

@mattklein123 mattklein123 self-assigned this Oct 20, 2018
htuch added 2 commits October 21, 2018 21:17
Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Harvey Tuch <htuch@google.com>
@htuch
Copy link
Copy Markdown
Member Author

htuch commented Oct 22, 2018

@mattklein123 discovered my secret attempt to outlaw exceptions in his absence :D J/K I've updated with feedback.

@mattklein123 mattklein123 merged commit 7f4c6ff into envoyproxy:master Oct 22, 2018
@htuch htuch deleted the no-exceptions-data branch October 22, 2018 21:19
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.

4 participants