-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGINT not working on 4-rc3 #2638
Comments
can you post your app code too |
In totality I cannot, but if there's something specific you need I could likely post that. |
We had also updated to this:
so that's a possible confounder. |
Just your main fn would do, things related to server set up |
#[actix_web::main]
async fn main() -> std::io::Result<()> {
env_logger::init();
// Initialize opentracing.
let statsd_string_url = env::var_os("redacted").extract_or("localhost:redacted_port");
let _tracer = new_pipeline()
.with_agent_endpoint("http://".to_string() + &statsd_string_url)
.with_service_name("redacted")
.with_version(<redacted>)
.install_batch(opentelemetry::runtime::Tokio)
.unwrap();
let db_url = env::var_os("redacted")
.extract_or("redacted");
let pool = Arc::new(
PgPoolOptions::new()
.max_connections(<redacted_uint>)
.connect(db_url.as_str())
.await
.unwrap(),
);
let schema = Schema::build(schema::MyQuery, EmptyMutation, EmptySubscription).finish();
HttpServer::new(move || {
App::new()
.wrap_fn(|request, service| {
// Wrap every request in a trace.
let tracer = opentelemetry::global::tracer("redacted");
let name = request.path().to_string();
let span_builder = tracer.span_builder(name.clone());
let span = span_builder
.start(&tracer);
let ctx = Context::current_with_span(span);
let _guard = ctx.clone().attach();
let result = service.call(request).with_context(ctx.clone());
use futures::FutureExt;
result.map(move |response| {
let status_code = match &response {
...redacted, returns an integer http status code
};
ctx.span().set_attribute(
opentelemetry::Key::new("redacted").i64(status_code.into()),
);
response
})
})
.app_data(AppState {
pool: pool.clone(),
schema: schema.clone(),
})
.service(web::resource("/").guard(guard::Post()).to(index))
.service(web::resource("/").guard(guard::Get()).to(playground))
.service(health)
})
.bind("redacted_host:redacted_port")?
.run()
.await?;
// Ensure all spans have been reported.
opentelemetry::global::shutdown_tracer_provider();
Ok(())
} |
Some logs
|
okay so it's definitely catching the SIGINT, stick a log between the server shutdown and the tracer shutdown |
log::error!("here1");
// Ensure all spans have been reported.
opentelemetry::global::shutdown_tracer_provider();
log::error!("here2"); Never do we reach "here2". Seems like this may be opentelemetry related, even though that library wasn't updated in version, we did switch to tokio feature there prompting this actix-web update to use tokio 1 in both places. |
Expected Behavior
^C sends SIGINT and kills the program after updating from 3.3.3 ro 4-rc3.
Current Behavior
SIGINT is ignored.
Possible Solution
Stop ignoring the signal.
Steps to Reproduce (for bugs)
actix-web = "4.0.0-rc.3"
.cargo run
.^C
.Context
Trying to kill the program.
Your Environment
macOS 11.6.
rustc 1.58.1 (db9d1b20b 2022-01-20)
actix-web = "4.0.0-rc.3"
The text was updated successfully, but these errors were encountered: