Skip to content

Commit

Permalink
dereference Data<> before calling on_response() (#754)
Browse files Browse the repository at this point in the history
* Set grpcio feature `"openssl"` on ubuntu platforms to address seg faulting on startup due to combination of openssl and boringssl.

Issue #742
  • Loading branch information
jrconlin authored Aug 4, 2020
1 parent 655c02e commit 76b577b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ validator = "0.10"
validator_derive = "0.10"
woothee = "0.11"

[target.'cfg(target_vendor="ubuntu")'.dependencies]
grpcio = { version="0.6", features=["openssl"] }

[dev-dependencies]
tokio = { version = "0.2", features = ["macros"] }

Expand Down
5 changes: 2 additions & 3 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use actix_web::{
error::ResponseError,
http::StatusCode,
middleware::errhandlers::ErrorHandlerResponse,
web::Data,
HttpResponse, Result,
};
use failure::{Backtrace, Context, Fail};
Expand Down Expand Up @@ -130,9 +129,9 @@ impl ApiError {
true
}

pub fn on_response(&self, state: &Data<ServerState>) {
pub fn on_response(&self, state: &ServerState) {
if self.is_conflict() {
Metrics::from(state.as_ref()).incr("storage.confict")
Metrics::from(state).incr("storage.confict")
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/web/middleware/sentry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where
Some(e) => {
if let Some(apie) = e.as_error::<ApiError>() {
if let Some(state) = sresp.request().app_data::<Data<ServerState>>() {
apie.on_response(state);
apie.on_response(state.as_ref());
};
if !apie.is_reportable() {
debug!("Not reporting error to sentry: {:?}", apie);
Expand Down

0 comments on commit 76b577b

Please sign in to comment.