[ZCM] [ZC] 1212/11 Comment "Zope fails to run on AMD x86_64"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Sat Apr 9 03:52:50 EDT 2005


Issue #1212 Update (Comment) "Zope fails to run on AMD x86_64"
 Status Pending, Zope/bug critical
To followup, visit:
  http://www.zope.org/Collectors/Zope/1212

==============================================================
= Comment - Entry #11 by ajung on Apr 9, 2005 3:52 am

Is this still an open problem? Otherwise we can close this issue soon.
________________________________________
= Comment - Entry #10 by tim_one on May 12, 2004 5:28 pm

I have no opinion on the efficacy of initgroups().

The patch is indeed "the usual" way to make this kind of code portable, and weakens the assumption to that sizeof(gid_t) <= sizeof(long).  That's a pretty safe bet, although I don't know whether any relevant standard says that gid_t must be an integral type to begin with.
________________________________________
= Comment - Entry #9 by tseaver on May 12, 2004 5:17 pm

For rationale behind initgroups, please see:

  http://www.zope.org/Members/zigg/UnixSecurityPatch

and

  http://zope.org/Collectors/Zope/1

Couldn't we fix the C code by declaring a local of type
long, using as an intermediate for PyArg_ParseTuple,
and then assigning it to the 'gid_t' local?.  E.g.:

diff -u -r1.4 initgroups.c
--- lib/Components/initgroups/initgroups.c	7 May 2004 10:46:06 -0000	1.4
+++ lib/Components/initgroups/initgroups.c	12 May 2004 21:15:35 -0000
@@ -23,10 +23,13 @@
 initgroups_initgroups(PyObject *self, PyObject *args)
 {
 	char *username;
+	long gid_as_long;
 	gid_t gid;
 
-	if (!PyArg_ParseTuple(args, "sl:initgroups", &username, &gid))
+	if (!PyArg_ParseTuple(args, "sl:initgroups", &username, &gid_as_long))
 		return NULL;
+
+    gid = (gid_t)gid_as_long;
 
 	if (initgroups(username, gid) == -1)
 		return PyErr_SetFromErrno(PyExc_OSError);


________________________________________
= Comment - Entry #8 by tim_one on May 12, 2004 4:27 pm

The code in initgroups.c is plain wrong on some (most, really) 64-bit platforms, because it implicitly assumes sizeof(long) == sizeof(gid_t).  Any "fix" that doesn't address that directly works by accident (by changing the stack stuff that gets overwritten by the incorrect PyArg_ParseTuple() call).  In a different collector report, ChrisM questioned why we need initgroups at all; getting rid of it is an alternative to fixing it.
________________________________________
= Comment - Entry #7 by oddjob on May 12, 2004 2:31 pm

As I said on my email, I also see the problem on my new x86 box. (i.e. it's not an AMD issue)

It could well be a distro issue (?) as I use Genoo (?)
________________________________________
= Comment - Entry #6 by ajung on May 12, 2004 2:11 pm

Since this change might be reasonable for x86_64 platforms only, is there a way to recognize such a platform from the 
Python level (sys.platform etc)? I would like to make this
change dependant on the platform.
________________________________________
= Comment - Entry #5 by oddjob on May 12, 2004 1:29 pm

Ok, my fix is to edit;
/opt/Zope-2.7/lib/python/zdaemon/zdctl.py

and insert;
flag = os.P_NOWAIT
as line 214.

(after the if self.options.daemon: test)
________________________________________
= Comment - Entry #4 by ajung on May 12, 2004 8:59 am

Were you able to fix this problem meanwhile?
________________________________________
= Comment - Entry #3 by oddjob on Feb 7, 2004 11:12 am

Note, although all seems to run "Ok", I do get this when starting in background mode ...

[root]# bin/zopectl start
Traceback (most recent call last):
  File "/opt/Zope-2.7/lib/python/Zope/Startup/zopectl.py", line 207, in ?
    main()
  File "/opt/Zope-2.7/lib/python/Zope/Startup/zopectl.py", line 190, in main
    c.onecmd(" ".join(options.args))
  File "/usr/lib64/python2.3/cmd.py", line 210, in onecmd
    return func(arg)
  File "/opt/Zope-2.7/lib/python/Zope/Startup/zopectl.py", line 134, in do_start
    ZDCmd.do_start(self, arg)
  File "/opt/Zope-2.7/lib/python/zdaemon/zdctl.py", line 214, in do_start
    os.spawnvp(flag, args[0], args)
  File "/usr/lib64/python2.3/os.py", line 543, in spawnvp
    return _spawnvef(mode, file, args, None, execvp)
  File "/usr/lib64/python2.3/os.py", line 504, in _spawnvef
    wpid, sts = waitpid(pid, 0)
OSError: [Errno 10] No child processes

________________________________________
= Comment - Entry #2 by oddjob on Feb 7, 2004 10:16 am

Ok, you're going to love this, I've managed to 'fix' the problem (and I kid you not, this solution works).

initgroups.c - insert one line in initgroups_initgroups
>        char *username;
>        gid_t gid;
                                                                                                                                                       +        printf("Debug Fix:: running initgroups\n");
                                                                                                                                                       
I now have RC2/PloneRC4 running on a Fedora Core x86_64 system. (ASUS SK8N/Opteron 1.8G)

________________________________________
= Request - Entry #1 by oddjob on Jan 31, 2004 12:05 am

Zope SEGV's at line 382 in modsupport.c

ZEO seems to run Ok.

Other Python apps seem fine.
Install is "basic", same Zope tar src file runs fine on i386 system.
==============================================================



More information about the Zope-Collector-Monitor mailing list