-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mobile: check for pending exceptions after JNI call (#24361)
Commit Message: Check for pending exceptions after some of the Java calls from within the JNI layer. At Lyft, we noticed that we have a bunch of crashes related to us not checking for exceptions after on_request_headers or/and on_response_headers methods. Additional description: I tried to use `ENVOY_LOG_EVENT_TO_LOGGER` to log when we detect a pending exception but ran into issues with deadlocks. Got rid of the extra logging to unblock my change. Risk Level: Low, mostly additive change. New code executes for when the library crashes previously. Testing: Integration test Docs Changes: Release Notes: Platform Specific Features: Signed-off-by: Rafal Augustyniak <raugustyniak@lyft.com>
- Loading branch information
1 parent
d99cd73
commit d3d4a01
Showing
8 changed files
with
294 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#pragma once | ||
|
||
#include "library/common/types/c_types.h" | ||
|
||
namespace Envoy { | ||
namespace Types { | ||
|
||
/** | ||
* A wrapper around envoy_headers that's responsible for freeing | ||
* the underlying headers when they are not needed anymore. | ||
*/ | ||
class ManagedEnvoyHeaders { | ||
public: | ||
/** | ||
* Initialize a new instance of the receiver using a given instance of envoy headers. | ||
* | ||
* @param headers, that should be wrapped by the receiver. The wrapper will hold onto | ||
* the passed headers and free them once the receiver is not used anymore. | ||
*/ | ||
ManagedEnvoyHeaders(envoy_headers headers) : headers_(headers){}; | ||
~ManagedEnvoyHeaders() { release_envoy_headers(headers_); } | ||
const envoy_headers& get() const { return headers_; } | ||
|
||
private: | ||
envoy_headers headers_; | ||
// Make copy and assignment operators private to prevent copying of the receiver. | ||
ManagedEnvoyHeaders(const ManagedEnvoyHeaders&); | ||
ManagedEnvoyHeaders& operator=(const ManagedEnvoyHeaders&); | ||
}; | ||
|
||
} // namespace Types | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.