public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Search Repo:
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
List VirtualDocumentRoot as incompatibility
Hongli Lai (Phusion) (author)
Thu May 01 01:02:52 -0700 2008
commit  3ec5dfc66bbf8b99d5b6f3894c13bdcdda0b7ef7
tree    86e7e5faef46dbbf2cb5990946437d520845bae1
parent  303e1b9e97d324c19f4593502758f8dd974a6a1d
...
703
704
705
 
 
 
 
706
707
708
...
703
704
705
706
707
708
709
710
711
712
0
@@ -703,6 +703,10 @@
0
 
0
 'mod_userdir' is not compatible with Phusion Passenger at the moment.
0
 
0
+==== VirtualDocumentRoot ====
0
+
0
+VirtualDocumentRoot is not compatible with Phusion Passenger at the moment.
0
+
0
 
0
 == Tips and notes ==
0
 
...
555
556
557
 
 
558
559
560
561
562
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
 
 
 
 
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
 
 
 
 
 
 
 
 
639
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
640
641
642
...
555
556
557
558
559
560
561
562
563
564
...
566
567
568
 
 
 
 
 
 
 
 
 
 
 
 
569
570
571
572
573
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
0
@@ -555,6 +555,8 @@
0
 static int
0
 init_module(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) {
0
   /*
0
+ * HISTORICAL NOTE:
0
+ *
0
    * The Apache initialization process has the following properties:
0
    *
0
    * 1. Apache on Unix calls the post_config hook twice, once before detach() and once
0
0
0
@@ -564,79 +566,63 @@
0
    * 3. On Unix, if the -X commandline option is given (the 'DEBUG' config is set),
0
    * detach() will not be called.
0
    *
0
- * The Passenger initialization process is pretty expensive because a spawn server has
0
- * to be started, so we'll want to avoid initializing twice because of property #2.
0
- *
0
- * The most straightforward solution is to initialize Passenger the second time
0
- * post_config is called. But unfortunately, that doesn't work if the Passenger
0
- * module is loaded after a graceful restart. There also doesn't seem to be any
0
- * good hooks that we can use to avoid double initialization.
0
- *
0
- * So as a hack, we check whether Apache has already been daemonized, by checking
0
- * whether ppid() returns 1. This doesn't work with Apache 2.0.x though: ppid()
0
- * doesn't return 1. So Apache 2.0.x users will just have to live with the double
0
- * initialization overhead.
0
+ * Because of property #2, the post_config hook is called twice. We initially tried
0
+ * to avoid this with all kinds of hacks and workarounds, but none of them are
0
+ * universal, i.e. it works for some people but not for others. So we got rid of the
0
+ * hacks, and now we always initialize in the post_config hook.
0
    */
0
- bool passengerShouldBeInitialized;
0
-
0
- #if (AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER >= 2) || AP_SERVER_MAJORVERSION_NUMBER > 2
0
- passengerShouldBeInitialized = getppid() == 1 || ap_exists_config_define("DEBUG");
0
- #else
0
- passengerShouldBeInitialized = true;
0
- #endif
0
- if (passengerShouldBeInitialized) {
0
- try {
0
- hooks = new Hooks(pconf, plog, ptemp, s);
0
- apr_pool_cleanup_register(pconf, NULL,
0
- destroy_hooks,
0
- apr_pool_cleanup_null);
0
- return OK;
0
- } catch (const thread_resource_error &e) {
0
- struct rlimit lim;
0
- string pthread_threads_max;
0
-
0
- lim.rlim_cur = 0;
0
- lim.rlim_max = 0;
0
- getrlimit(RLIMIT_NPROC, &lim);
0
- #ifdef PTHREAD_THREADS_MAX
0
- pthread_threads_max = toString(PTHREAD_THREADS_MAX);
0
- #else
0
- pthread_threads_max = "unknown";
0
- #endif
0
-
0
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
0
- "*** Passenger could not be initialize because a "
0
- "threading resource could not be allocated or initialized. "
0
- "The error message is:");
0
- fprintf(stderr,
0
- " %s\n\n"
0
- "System settings:\n"
0
- " RLIMIT_NPROC: soft = %d, hard = %d\n"
0
- " PTHREAD_THREADS_MAX: %s\n"
0
- "\n",
0
- e.what(),
0
- (int) lim.rlim_cur, (int) lim.rlim_max,
0
- pthread_threads_max.c_str());
0
-
0
- fprintf(stderr, "Output of 'uname -a' follows:\n");
0
- fflush(stderr);
0
- system("uname -a >&2");
0
-
0
- fprintf(stderr, "\nOutput of 'ulimit -a' follows:\n");
0
- fflush(stderr);
0
- system("ulimit -a >&2");
0
-
0
- return DECLINED;
0
-
0
- } catch (const exception &e) {
0
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
0
- "*** Passenger could not be initialized because of this error: %s",
0
- e.what());
0
- hooks = NULL;
0
- return DECLINED;
0
- }
0
- } else {
0
+ if (hooks != NULL) {
0
+ delete hooks;
0
+ }
0
+ try {
0
+ hooks = new Hooks(pconf, plog, ptemp, s);
0
+ apr_pool_cleanup_register(pconf, NULL,
0
+ destroy_hooks,
0
+ apr_pool_cleanup_null);
0
     return OK;
0
+ } catch (const thread_resource_error &e) {
0
+ struct rlimit lim;
0
+ string pthread_threads_max;
0
+
0
+ lim.rlim_cur = 0;
0
+ lim.rlim_max = 0;
0
+ getrlimit(RLIMIT_NPROC, &lim);
0
+ #ifdef PTHREAD_THREADS_MAX
0
+ pthread_threads_max = toString(PTHREAD_THREADS_MAX);
0
+ #else
0
+ pthread_threads_max = "unknown";
0
+ #endif
0
+
0
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
0
+ "*** Passenger could not be initialize because a "
0
+ "threading resource could not be allocated or initialized. "
0
+ "The error message is:");
0
+ fprintf(stderr,
0
+ " %s\n\n"
0
+ "System settings:\n"
0
+ " RLIMIT_NPROC: soft = %d, hard = %d\n"
0
+ " PTHREAD_THREADS_MAX: %s\n"
0
+ "\n",
0
+ e.what(),
0
+ (int) lim.rlim_cur, (int) lim.rlim_max,
0
+ pthread_threads_max.c_str());
0
+
0
+ fprintf(stderr, "Output of 'uname -a' follows:\n");
0
+ fflush(stderr);
0
+ system("uname -a >&2");
0
+
0
+ fprintf(stderr, "\nOutput of 'ulimit -a' follows:\n");
0
+ fflush(stderr);
0
+ system("ulimit -a >&2");
0
+
0
+ return DECLINED;
0
+
0
+ } catch (const exception &e) {
0
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
0
+ "*** Passenger could not be initialized because of this error: %s",
0
+ e.what());
0
+ hooks = NULL;
0
+ return DECLINED;
0
   }
0
 }
0
 

Comments

    No one has commented yet.