Quoting John Capo ([EMAIL PROTECTED]):
> 
> Probably related, I can not run index with more than 1 thread.  I
> am going to increase thread stack sizes in index and see if that
> helps.
> 

Increasing thread stack in index seems to fix my problems.  I have
been running a crawl with 10 threads for an hour just fine.  With
default stack size, running index with more than 1 thread would
corrupt the database within a minute or so and index would loop
printing something about `Param'.

I have not had any problems with s.cgi but I patched s.cgi anyway.

Conditional thread stack size is the answer.  I think 2MB on Linux
may be a bit too much.

Now, if you guys can fix the broken site: search, I would be a very
happy camper.

John Capo




diff -u -r ../../orig-aspseek-1.2.4a/src/datasource.cpp ./datasource.cpp
--- ../../orig-aspseek-1.2.4a/src/datasource.cpp        Tue Jul  3 12:38:00 2001
+++ ./datasource.cpp    Tue Jul 24 12:23:26 2001
@@ -786,12 +786,16 @@
        // Process all daemons
        for (CDaemonSet::iterator it = daemons.begin(); it != daemons.end(); it++)
        {
+               pthread_attr_t attr;
+               pthread_attr_init(&attr);
+               pthread_attr_setstacksize(&attr, 128000);
+
                pthread_t thread;
                CDaemonAddress* addr = const_cast<CDaemonAddress*>(&(*it));
                CTcpContext* ctx = new CTcpContext(this);       // Create thread 
context
                ctx->m_address = addr;
                m_sources.push_back(ctx);
-               pthread_create(&thread, NULL, Search, ctx);     // Create thread for 
connection
+               pthread_create(&thread, &attr, Search, ctx);    // Create thread for 
+connection
                threads++;
        }
        while (threads)
diff -u -r ../../orig-aspseek-1.2.4a/src/geo.cpp ./geo.cpp
--- ../../orig-aspseek-1.2.4a/src/geo.cpp       Tue Jul  3 12:38:01 2001
+++ ./geo.cpp   Tue Jul 24 11:02:57 2001
@@ -649,7 +649,11 @@
                rm.m_wcache = &wcache;
                for (int i = 0; i < 50; i++)
                {
-                       pthread_create(threads + i, NULL, ::TestCountry, &rm);
+                       pthread_attr_t attr;
+                       pthread_attr_init(&attr);
+                       pthread_attr_setstacksize(&attr, 128000);
+
+                       pthread_create(threads + i, &attr, ::TestCountry, &rm);
                }
                for (int i = 0; i < 50; i++)
                {
diff -u -r ../../orig-aspseek-1.2.4a/src/hrefs.cpp ./hrefs.cpp
--- ../../orig-aspseek-1.2.4a/src/hrefs.cpp     Tue Jul  3 12:38:01 2001
+++ ./hrefs.cpp Tue Jul 24 11:02:13 2001
@@ -406,9 +406,13 @@
        }
        for (n = 0; n < NUM_THREADS; n++)
        {
+               pthread_attr_t attr;
+               pthread_attr_init(&attr);
+               pthread_attr_setstacksize(&attr, 128000);
+
                tests[n].test = &test;
                tests[n].step = primes[n];
-               if (pthread_create(threads + n, NULL, ::TestHrefCache1, tests + n) != 
0) break;
+               if (pthread_create(threads + n, &attr, ::TestHrefCache1, tests + n) != 
+0) break;
        }
        for (int i = 0; i < n; i++)
        {
diff -u -r ../../orig-aspseek-1.2.4a/src/wcache.cpp ./wcache.cpp
--- ../../orig-aspseek-1.2.4a/src/wcache.cpp    Tue Jul  3 12:38:01 2001
+++ ./wcache.cpp        Tue Jul 24 11:02:44 2001
@@ -759,9 +759,13 @@
        }
        for (n = 0; n < NUM_THREADS; n++)
        {
+               pthread_attr_t attr;
+               pthread_attr_init(&attr);
+               pthread_attr_setstacksize(&attr, 128000);
+
                tests[n].test = &test;
                tests[n].step = primes[n];
-               if (pthread_create(threads + n, NULL, ::TestCache1, tests + n) != 0) 
break;
+               if (pthread_create(threads + n, &attr, ::TestCache1, tests + n) != 0) 
+break;
        }
        for (int i = 0; i < n; i++)
        {
@@ -973,9 +977,13 @@
        // Initialize thread parameters and start indexing threads
        for (n = 0; n < num_threads; n++)
        {
+               pthread_attr_t attr;
+               pthread_attr_init(&attr);
+               pthread_attr_setstacksize(&attr, 128000);
+
                threads[n].m_cache = this;
                threads[n].m_thread = n;
-               if (pthread_create(&threads[n].m_threadt, NULL, ::Index1, threads + n) 
!= 0) break;
+               if (pthread_create(&threads[n].m_threadt, &attr, ::Index1, threads + 
+n) != 0) break;
        }
        // Wait all threads to finish
        for (int i = 0; i < n; i++)

Reply via email to