I build a server with Actix-web 2.0, and the memory was increasing with the increasing of requests. I don't know where is the problem, I just used awc(with tls), web. when I change all things to warp the problem is gone. I don't know how to find it.
@shaitao you'll need to provide us with a minimal example so we can help
My actix server is leaking memory when It's behind nginx (using proxy_pass). And everything is fine when connecting to directly. It's like few megabytes per 3000 requests. I will work on minimal reproduction example this weekend.
@Lesiuk is this related to your recent issue in https://github.com/actix/actix-web/issues/1446 ?
@pythoneer yes, It's this issue and during investigation I was debugging a little a didnt found any other major leak
wait, this issue was filed before the release of actix-rt 1.1 so can't be the same issue right?
For me with 2.0.0 even this simple example leaks memory:
HttpServer::new(|| App::new().route("/", web::get().to(HttpResponse::Ok)))
Tested like this:
ab -c 100 -n 100000 http://localhost:8081/
With above command process consumes 315M of memory, with second call 626M, with third 939M, you get the idea.
Behavior is the same with both debug and release build.
I think this is quite a critical issue, surprised not many people have noticed it.
Unfortunately I cannot reproduce it. Could you give us more info? Which operating system are you using? Actix-rt version?
Ubuntu 20.10 (development branch), actix-rt 1.1.0.
Updating to actix-rt 1.1.1 seems to fix the issue for me.
@nazar-pc thats the reason why actix-rt 1.1.0 was yanked https://github.com/actix/actix-net/issues/129
Yeah, but I had it in lock file, so it installed fine anyway.
Unless there is additional evidence I believe this issue can be closed.
This is also likely related to https://github.com/actix/actix-web/issues/1464
I'm also played with basic actix http2 3.0.0-alpha.3 and also notice some kind of memory leak
Simple h2 server reponse with some json literal:
pub async fn get_post() -> Result<HttpResponse> {
Ok(HttpResponse::Ok().content_type("application/json").body(r#"{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}"#))
}
#[actix_rt::main]
async fn main() -> io::Result<()> {
Server::build()
.bind("hello", "127.0.0.1:8081", || {
HttpService::build()
.h2(map_config(
App::new().service(web::resource("/").route(web::to(get_post))),
|_| AppConfig::default(),
))
.tcp()
})
.expect("Failed to start server")
.run()
.await
}
h2 load:
h2load -n1000000 -c1000 -m1000 -v http://localhost:8081
Strange thing is cargo run can survive the load , while cargo run --release is noticeable slower and hang my mac in the end
Tenatively fixed with #1580.
Most helpful comment
Ubuntu 20.10 (development branch), actix-rt 1.1.0.
Updating to actix-rt 1.1.1 seems to fix the issue for me.