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

Memory leak in Core when overloading with requests #1797

Closed
OnixGH opened this issue Apr 13, 2016 · 0 comments
Closed

Memory leak in Core when overloading with requests #1797

OnixGH opened this issue Apr 13, 2016 · 0 comments
Milestone

Comments

@OnixGH
Copy link
Contributor

OnixGH commented Apr 13, 2016

When running Passenger with valgrind and spamming the server with small POST requests locally, it ends up with leaked memory. E.g. on Ubuntu 14.04 with 5.0.27 (also occurs with 5.0.26):

==20840== 8,994,816 bytes in 549 blocks are definitely lost in loss record 13 of 13
==20840==    at 0x4C2D110: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20840==    by 0x4C2D227: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20840==    by 0x47C1F4: call_memalign(unsigned long, unsigned long) (palloc.cpp:47)
==20840==    by 0x47C2C0: psg_create_pool(unsigned long) (palloc.cpp:62)
==20840==    by 0x5F3C70: Passenger::ServerKit::HttpServer<Passenger::Core::Controller, Passenger::Core::Client>::reinitializeRequest(Passenger::Core::Client*, Passenger::Core::Request*) (HttpServer.h:870)
==20840==    by 0x5E6070: Passenger::Core::Controller::reinitializeRequest(Passenger::Core::Client*, Passenger::Core::Request*) (Hooks.cpp:121)
==20840==    by 0x5FA5E2: Passenger::ServerKit::HttpServer<Passenger::Core::Controller, Passenger::Core::Client>::handleNextRequest(Passenger::Core::Client*) (HttpServer.h:253)
==20840==    by 0x5F3A75: Passenger::ServerKit::HttpServer<Passenger::Core::Controller, Passenger::Core::Client>::onClientAccepted(Passenger::Core::Client*) (HttpServer.h:707)
==20840==    by 0x5E5DAC: Passenger::Core::Controller::onClientAccepted(Passenger::Core::Client*) (Hooks.cpp:92)
==20840==    by 0x607153: Passenger::ServerKit::BaseServer<Passenger::Core::Controller, Passenger::Core::Client>::onClientsAccepted(Passenger::Core::Client**, unsigned int) (Server.h:540)
==20840==    by 0x55810C: Passenger::ServerKit::BaseServer<Passenger::Core::Controller, Passenger::Core::Client>::feedNewClients(int const*, unsigned int) (Server.h:797)
==20840==    by 0x55138E: Passenger::ServerKit::AcceptLoadBalancer<Passenger::Core::Controller>::feedNewClient(Passenger::Core::Controller*, int) (AcceptLoadBalancer.h:174)
  • worker_connections is set to 10000 to avoid the "not enough workers" error
  • passenger_socket_backlog is also set higher than that, although I still see the "connect() to unix:/tmp/passenger.M6yCfQv/agents.s/core failed (11: Resource temporarily unavailable) while connecting to upstream: error", which is something that I didn't expect either

The POST request is something simple, and every upload gets dumped to the same file called "last_upload":

POST /upload/create HTTP/1.1
Host: 127.0.0.1:3000
Connection: close
Content-length: 10

1234567890

The load script is also simple:

#!/bin/bash
for i in `seq 1 1000`;
do
for j in `seq 1 7`;
do
cat post.txt | nc 127.0.0.1 3000 -q 10 >/dev/null &
done
perl -e 'select(undef,undef,undef,.001)'
done
OnixGH pushed a commit that referenced this issue Apr 13, 2016
Need to investigate if the optimization was intended there at all, and
if so, whether there is a more optimal solution.
@OnixGH OnixGH closed this as completed in babd7fe Apr 14, 2016
@OnixGH OnixGH added this to the 5.0.28 milestone Apr 28, 2016
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

1 participant