(Everything is using Pike 7.6.66, but .64 has the same problem)
I have a problem to get threads or Process to work properly with glibc-2.3.5 (or something related). I'm using Mandriva 2006 and Gcc-4.0.1. gcc-2.96 works just as badly.
All my glibc-2.3.4 system works.
/* Here is the program that hangs (after 2-6 "Ho!" and the same number of "Bar" usually, but sometimes it works) */ int xx=0; void main () { mixed a() { return allocate(10, thread_create) ( lambda() { write("Ho!\n"); for (int x=0; x<10; x++) { for (int e=0; e<50; e++) if (Process.create_process(({"/bin/cat","/dev/null"}))->wait()) return e; } write("Hej!\n"); __signal_watchdog(); return -1; } )->wait() - ({-1}); }; mixed b() { return ({}); }; a(); write("Bar\n"); b(); write(( file_stat("/bin/cat") && file_stat("/dev/null") && all_constants()->thread_create && (cpp("__NT__")/"\n")[1]=="__NT__" ) +"\n"); write("xx"+xx+"\n"); }
void __signal_watchdog() { xx++; return; }
/* end program */
I have tried to build Pikes on the working systems and do "make bin_export" (Even with --without-dynamic-modules), but the result is the same.
But if I try the Pike built by Roxen ( http://download.roxen.com/4.0/ in the Roxen Webserver 4.0.425 Fedora Core 4 x86 package) it runs the program above without problems, but it still hangs my Roxen about 2 times a day (when it's under heavy load). "hangs" means that it uses 0 CPU and doesn't do a thing, and needs to be killed with -9.
So my question is: Has anyone else got glibc-2.3.5 to work perfectly with Pike (make verify)? And then: Is this Pike's or glibc's fault? If it's glibc's fault, then I need some help to write a bug-report.
I did get some related warnings while compiling Pike:
/home/hedda/Pike-v7.6.66/src/dynamic_load.c: In function 'exit_dynamic_load': /home/hedda/Pike-v7.6.66/src/dynamic_load.c:647: warning: variable 'tmp' might be clobbered by 'longjmp' or 'vfork'
/home/hedda/Pike-v7.6.66/src/object.c: In function 'call_destroy': /home/hedda/Pike-v7.6.66/src/object.c:677: warning: variable 'e' might be clobbered by 'longjmp' or 'vfork'
/home/hedda/Pike-v7.6.66/src/program.c: In function 'store_constant': /home/hedda/Pike-v7.6.66/src/program.c:5299: warning: variable 'e' might be clobbered by 'longjmp' or 'vfork'
But when I fix the warnings by using "volatile"-declarations of these variables, the above program still doesn't work, so I guess it's unrelated.
Grubba had the theory:
"~ Your header-files probably don't match your thread-libraries. ~" (14133489) /Henrik Grubbström (Lysator)/--
But that doesn't seem to be the case, as this is happening on two different systems, and they _should_ be OK. But there might of course be a Mandriva 2006-problem with its headerfiles or something.
I'm not sure that it is only a glibc-2.3.5 problem. I'm running fedora core 4, it has glibc-2.3.5, and your sample code worked fine. Maybe it is a combination of things...
pike-devel@lists.lysator.liu.se