Skip to content
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

possible memory leak #1428

Closed
shaitao opened this issue Mar 24, 2020 · 13 comments
Closed

possible memory leak #1428

shaitao opened this issue Mar 24, 2020 · 13 comments

Comments

@shaitao
Copy link

shaitao commented Mar 24, 2020

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.

@robjtede robjtede transferred this issue from actix/actix Mar 24, 2020
@robjtede robjtede changed the title Memory leak possible memory leak Mar 24, 2020
@robjtede
Copy link
Member

@shaitao you'll need to provide us with a minimal example so we can help

@Lesiuk
Copy link
Contributor

Lesiuk commented Apr 8, 2020

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.

@pythoneer
Copy link
Member

@Lesiuk is this related to your recent issue in https://github.com/actix/actix-web/issues/1446 ?

@Lesiuk
Copy link
Contributor

Lesiuk commented Apr 10, 2020

@pythoneer yes, It's this issue and during investigation I was debugging a little a didnt found any other major leak

@robjtede
Copy link
Member

wait, this issue was filed before the release of actix-rt 1.1 so can't be the same issue right?

@nazar-pc
Copy link

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.

@Lesiuk
Copy link
Contributor

Lesiuk commented May 19, 2020

Unfortunately I cannot reproduce it. Could you give us more info? Which operating system are you using? Actix-rt version?

@nazar-pc
Copy link

Ubuntu 20.10 (development branch), actix-rt 1.1.0.
Updating to actix-rt 1.1.1 seems to fix the issue for me.

@Lesiuk
Copy link
Contributor

Lesiuk commented May 19, 2020

@nazar-pc thats the reason why actix-rt 1.1.0 was yanked actix/actix-net#129

@nazar-pc
Copy link

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.

@jtescher
Copy link
Contributor

This is also likely related to #1464

@singggum3b
Copy link

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

@robjtede
Copy link
Member

Tenatively fixed with #1580.

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

No branches or pull requests

7 participants