is_mp(), sysconf, and atoi. (Statically-linked multithreaded app s broken on X86?)
Fri Mar 7 01:58:00 GMT 2003
I tried to build SPECjbb with the trunk under RedHat 8.0 on X86. Running the result consistently runs into the problem that sysconf(_SC_NPROCESSORS_ONLN) fails in statically linked executables, as reported in http://gcc.gnu.org/ml/java/2002-11/msg00301.html .
My attempts to understand this were not entirely suuccessful, at least so far. The problem does not disappear if I call GC_get_nprocs() instead of sysconf. If I make this change it dies in the glibc atoi() implementation. AFAICT atoi is called on a perfectly good string. I didn't rebuild glibc, but it looks as though this effectively goes through strtol, which needs to access locale stuff (?) which isn't there for some reason.
The attached larger patch does fix the problem by also bypassing atoi() in GC_get_nprocs. (The boehm-gc part of the patch isn't as bad as it looks at first glance since it removes an unpleasant subtlety in the original code. I wouldn't mind putting it in my tree. The natObject.cc part of the patch is quite ugly. It also includes a minor unrelated performance patch. Sorry about that.)
I suspect this affects all statically-linked and interstingly-multy-threaded programs on linux-X86. (IA64 seems fine.) Thus it should possibly be considered a fairly high priority bug.
1) Has anyone else looked at this?
2) Any ideas for a better patch?
3) If not, should I check in the attached patch (cleaned up, with ChangeLog entry)? In 3.3 as well?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2849 bytes
Desc: not available
More information about the Java