GNOME Bugzilla – Bug 304790
gthread shouldn't abort when stacksize cannot be set
Last modified: 2005-06-09 15:27:24 UTC
Distribution/Version: Debian unstable Although GNU/Hurd's libpthread includes a pthread_attr_setstacksize() function, it is mostly a stub and returns EINVAL except if the caller specifies a stack size of 2MB. However, gthread just bails out if pthread_attr_setstacksize() fails, resulting in e.g. gnome-display-properties and nautilus to abort upon startup: GThread-ERROR **: file gthread-posix.c: line 310 (): error 'Invalid argument' during 'pthread_attr_setstacksize (&attr, stack_size)' aborting... Instead, we believe it should not fail if this optional feature cannot be met and simply continue. Neal Walfield has written some more on this at http://lists.debian.org/debian-hurd/2005/05/msg00117.html: -begin quote-- Our current libpthread doesn't support floating stacks. To get at the thread specific data (TSD), we look at the base of the stack. To find the base of the stack, we take the current stack point and bitwise and it with ~(2MB - 1). This mode of operation makes supporting user stacks very difficult as we have no mechanism to express these constraints to the user. Currently, pthread_attr_setstacksize is essentially a stub (if the caller specifies 2MB it succeeds all other values return EINVAL). glib thinks that since it is present (it checks for it using autoconf, apparently), it must work. Arguably, we are not not POSIX compliant: The pthread_attr_setstacksize() function shall fail if: [EINVAL] The value of stacksize is less than {PTHREAD_STACK_MIN} or exceeds a system-imposed limit. Thus for our implementation PTHREAD_STACK_MIN would be 2MB and the system imposed limit would be 2MB. [...] Since glib just ignores the stack size parameter if pthread_attr_setstacksize is not found, it should just ignore any failure. --end quote--
Created attachment 46650 [details] [review] Proposed patch removing error check Just a proposal, as I am not sure what else posix_check_cmd does.
posix_check_cmd does nothing beyond reporting the error (it is defined earlier in the same file).
2005-06-09 Matthias Clasen <mclasen@redhat.com> * gthread-posix.c (g_thread_create_posix_impl): Allow setstacksize to fail. (#304790, Michael Banck)