Something is definitely wrong. The private dirty RSS should never be
larger than 1 MB, but in your case it's already more than 100 MB.
Which operating system is your production server running?
Regards,
Hongli Lai
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)
Nice job with tracking down this bug!
The reason why discardStream() is called, is to avoid
double-file-descriptor-closing bugs. If you're using Apache with the
prefork MPM, then you can solve this bug by commenting out the
discardStream() call. This will cause the socket with the Rails
application to be closed twice, but that's OK.
If you're using Apache with the worker MPM however, then closing file
descriptors twice can cause strange problems. I'll look into this today.
Regards,
Hongli Lai
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
I tried TonyLa's test script, and I could not reproduce the problem.
Interestingly I couldn't reproduce the problem with the 2.0.1 codebase
either. :-|
I'm running Ubuntu Linux 8.04 here.
Regards,
Hongli Lai
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Could you try to debug this with Valgrind? You can start the application
pool server by editing ext/apache2/ApplicationPoolServer.h, line 487. If
you change the "#if 0" there to "#if 1" then it'll be started in
Valgrind. You may want to add "--leak-check=yes" to Valgrind as parameter.
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
The bug has been confirmed.
Your fix is not entirely correct however. If the server's shutting down
(i.e. received SIGINT) while there are still client threads running,
then Server will attempt to gracefully shutdown all threads, so
thr->interrupt_and_join() is necessary. I've decoupled the 'delete thr'
statement from the 'thr->interrupt_and_join()' statement, like this:
if (thr != NULL) {
if (thr->get_id() != this_thread::get_id()) {
thr->interrupt_and_join();
}
delete thr;
}
Thanks for the awesome analysis. :) The problem should be fixed in
commit 9cc8ee3a8eb23ff630173b12361fde6bb1fc2d5f. Please verify.
Regards,
Hongli Lai
--
Phusion | The Computer Science Company
Web: http://www.phusion.nl/
E-mail: in...@phusion.nl