* Cleaned up the rcs/cvs Id tags and leading comments at the top of some files
[citadel.git] / webcit / webserver.c
index 86bcecbad3a479a5c5acaafded4f74d805f15449..faa836d300e006b0f00a9e1c20c133cfdc6b7aa8 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * webserver.c
+ * $Id$
  *
  * This contains a simple multithreaded TCP server manager.  It sits around
  * waiting on the specified port for incoming HTTP connections.  When a
  * connection is established, it calls context_loop() from context_loop.c.
  *
- * $Id$
  */
 
 #include <ctype.h>
@@ -233,6 +232,7 @@ void start_daemon(int do_close_stdio)
 void spawn_another_worker_thread() {
        pthread_t SessThread;   /* Thread descriptor */
        pthread_attr_t attr;    /* Thread attributes */
+       int ret;
 
        lprintf(3, "Creating a new thread\n");
 
@@ -240,6 +240,15 @@ void spawn_another_worker_thread() {
        pthread_attr_init(&attr);
        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
 
+       /* Our per-thread stacks need to be bigger than the default size, otherwise
+        * the MIME parser crashes on FreeBSD, and the IMAP service crashes on
+        * 64-bit Linux.
+        */
+       if ((ret = pthread_attr_setstacksize(&attr, 1024 * 1024))) {
+               lprintf(1, "pthread_attr_setstacksize: %s\n", strerror(ret));
+               pthread_attr_destroy(&attr);
+       }
+
        /* now create the thread */
        if (pthread_create(&SessThread, &attr,
                        (void *(*)(void *)) worker_entry, NULL)