public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* XWin Server starts but terminates shortly after
@ 2015-11-12 10:11 Thomas Schweikle
  2015-11-12 14:42 ` Jon Turney
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Schweikle @ 2015-11-12 10:11 UTC (permalink / raw)
  To: Cygwin, Cygwin

Since about six months: I can start XWin-Server, but it terminates
shortly after without any chance to start any X11-application.

The X11-log shows:
-- SNIP
# cat XWin.0.log
Welcome to the XWin X Server
Vendor: The Cygwin/X Project
Release: 1.17.4.0
OS: CYGWIN_NT-6.1 nc403-muc 2.3.0(0.291/5/3) 2015-11-09 10:24 x86_64
OS: Windows 7 Service Pack 1 [Windows NT 6.1 build 7601] (Win64)
Package: version 1.17.4-1 built 2015-10-29

XWin was started with the following command line:

/usr/bin/XWin -multiwindow -clipboard

ddxProcessArgument - Initializing default screens
winInitializeScreenDefaults - primary monitor w 1920 h 1200
winInitializeScreenDefaults - native DPI x 96 y 96
[   996.393] (II) xorg.conf is not supported
[   996.393] (II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html
for more information
[   996.393] LoadPreferences: /cygdrive/c/Users/sct-muc.BFS/.XWinrc not found
[   996.393] LoadPreferences: Loading /etc/X11/system.XWinrc
[   996.393] LoadPreferences: Done parsing the configuration file...
[   996.409] winDetectSupportedEngines - DirectDraw4 installed,
allowing ShadowDDNL
[   996.409] winDetectSupportedEngines - Returning, supported engines 00000005
[   996.456] winSetEngine - Multi Window or Rootless => ShadowGDI
[   996.456] winScreenInit - Using Windows display depth of 32 bits per pixel
[   996.456] winAllocateFBShadowGDI - Creating DIB with width: 1920
height: 1200 depth: 32
[   996.456] winFinishScreenInitFB - Masks: 00ff0000 0000ff00 000000ff
[   996.456] winInitVisualsShadowGDI - Masks 00ff0000 0000ff00
000000ff BPRGB 8 d 24 bpp 32
[   996,471] MIT-SHM extension disabled due to lack of kernel support
[   996,471] XFree86-Bigfont extension local-client optimization
disabled due to lack of shared memory support in the kernel
[   996,471] glWinSelectGLimplementation: Loaded 'cygnativeGLthunk.dll'
-- SNAP

xorg.conf is no existing.
An user ~/.XWinrc doesn't exist.
A system wide /etc/X11/system.XWinrc exists:
-- SNIP
$ cat /etc/X11/system.XWinrc
# XWin Server Resource File - EXAMPLE
# Earle F. Philhower, III

# Place in ~/.XWinrc or in /etc/X11/system.XWinrc

# Keywords are case insensitive, comments legal pretty much anywhere
# you can have an end-of-line

# Comments begin with "#" or "//" and go to the end-of-line

# Paths to commands are **cygwin** based (i.e. /usr/local/bin/xcalc)

# Paths to icons are **WINDOWS** based (i.e. c:\windows\icons)

# Menus are defined as...
# MENU <name> {
#       <Menu Text>     EXEC    <command>
#                               ^^ This command will have any "%display%"
#                                  string replaced with the proper display
#                                  variable (i.e. 127.0.0.1:<display>.0)
#                                  (This should only rarely be needed as
#                                  the DISPLAY environment variable is also
#                                  set correctly)
#  or   <Menu Text>     MENU    <name-of-some-prior-defined-menu>
#  or   <Menu Text>     ALWAYSONTOP
#                         ^^ Sets the window to display above all others
#  or   <Menu Text>     RELOAD
#                         ^^ Causes ~/.XWinrc or the system.XWinrc file
#                            to be reloaded and icons and menus regenerated
#  or   SEPARATOR
#       ...
# }

# Set the taskmar menu with
# ROOTMENU <name-of-some-prior-defined-menu>

# If you want a menu to be applied to all popup window's system menu
# DEFAULTSYSMENU <name-of-some-prior-defined-menu> <atstart|atend>

# To choose a specific menu for a specific WM_CLASS or WM_NAME use ...
# SYSMENU {
#       <class-or-name-of-window> <name-of-prior-defined-menu> <atstart|atend>
#       ...
# }

# When specifying an ICONFILE in the following commands several different
# formats are allowed:
# 1. Name of a regular Windows .ico format file
#    (ex:  "cygwin.ico", "apple.ico")
# 2. Name and index into a Windows .DLL
#    (ex: "c:\windows\system32\shell32.dll,4" gives the default folder icon
#         "c:\windows\system32\shell32.dll,5" gives the floppy drive icon)
# 3. Index into XWin.EXE internal ICON resource
#    (ex: ",101" is the 1st icon inside XWin.exe)

# To define where ICO files live (** Windows path**)
# ICONDIRECTORY <windows-path i.e. c:\cygwin\usr\icons>
# NOTE: If you specify a fully qualified path to an ICON below
#             (i.e. "c:\xxx" or "d:\xxxx")
#       this ICONDIRECTORY will not be prepended

# To change the taskbar icon use...
# TRAYICON       <name-of-windows-ico-file-in-icondirectory>

# To define a replacement for the standard X icon for apps w/o specified icons
# DEFAULTICON   <name-of-windows-ico-file-in-icondirectory>

# To define substitute icons on a per-window basis use...
# ICONS {
#       <class-or-name-of-window> <icon-file-name.ico>
#       ...
# }
# In the case where multiple matches occur, the first listed in the ICONS
# section will be chosen.

# To disable exit confirmation dialog add the line containing SilentExit

# DEBUG <string> prints out the string to the XWin.log file

// Below are just some silly menus to demonstrate writing your
// own configuration file.

// Make some menus...
menu apps {
        xterm   exec    "xterm"
        "Emacs" exec    "emacs"
        notepad exec    notepad
        xload   exec    "xload -display %display%"  # Comment
}

menu root {
        "Applications"  menu    apps
// Comments fit here, too...

        SEPARATOR
        FAQ            EXEC "cygstart
http://x.cygwin.com/docs/faq/cygwin-x-faq.html"
        "User's Guide" EXEC "cygstart
http://x.cygwin.com/docs/ug/cygwin-x-ug.html"
        SEPARATOR
        "View logfile" EXEC "xterm -title $XWINLOGFILE -e less +F $XWINLOGFILE"
        SEPARATOR

        "Reload .XWinrc"        RELOAD
        SEParATOR
}

menu aot {
        Separator
        "Always on Top" alwaysontop
}

menu xtermspecial {
        "Emacs"         exec    "emacs"
        "Always on Top" alwaysontop
        SepArAtor
}

RootMenu root

DefaultSysMenu aot atend

SysMenu {
        "xterm" xtermspecial atstart
}

# IconDirectory "c:\winnt\"

# DefaultIcon   "reinstall.ico"

# Icons {
#       "xterm" "uninstall.ico"
# }

SilentExit

DEBUG "Done parsing the configuration file..."
-- SNAP

and is more or less left at defaults.

XWin-Server is started by:
"C:\cygwin\bin\run.exe /usr/bin/XWin -multiwindow -clipboard" with
default directory set to "C:\cygwin\bin".

In "/etc/X11/xinit/startxwinrc"
-- SNIP
$ cat /etc/X11/xinit/startxwinrc
#!/bin/sh
# Copyright (C) 1999 - 2005, 2014 Red Hat, Inc. All rights reserved. This
# copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the
# GNU General Public License version 2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# Authors:
#       Yaakov Selkowitz <yselkowi@redhat.com>

# redirect errors to a file in user's home directory if we can
if [ -z "$GDMSESSION" ]; then
    # GDM redirect output itself in a smarter fashion
    errfile="$HOME/.xsession-errors"
    if ( umask 077 && cp /dev/null "$errfile" 2> /dev/null ); then
        chmod 600 "$errfile"
        [ -x /sbin/restorecon ] && /sbin/restorecon $errfile
        exec > "$errfile" 2>&1
    else
        errfile=$(mktemp -q /tmp/xses-$USER.XXXXXX)
        if [ $? -eq 0 ]; then
            exec > "$errfile" 2>&1
        fi
    fi
fi

# Mandatorily source xinitrc-common, which is common code shared between the
# Xsession and xinitrc scripts which has been factored out to avoid duplication
. /etc/X11/xinit/xinitrc-common

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.
if [ -f $HOME/.startxwinrc ] ; then
    exec $CK_XINIT_SESSION $SSH_AGENT $HOME/.startxwinrc || \
    exec $CK_XINIT_SESSION $SSH_AGENT $HOME/.startxwinrc
else
    # default settings
    [ -x /usr/bin/xdg-user-dirs-gtk-update ] &&
/usr/bin/xdg-user-dirs-gtk-update
    [ -x /usr/bin/gsettings-data-convert ] && /usr/bin/gsettings-data-convert

    if [ -x /usr/libexec/mate-notification-daemon ] ; then
        /usr/libexec/mate-notification-daemon &
    elif [ -x /usr/libexec/notification-daemon ] ; then
        /usr/libexec/notification-daemon &
    elif [ -x /usr/lib/xfce4/notifyd/xfce4-notifyd ] ; then
        /usr/lib/xfce4/notifyd/xfce4-notifyd &
    elif [ -x /usr/bin/lxqt-notificationd ] ; then
        /usr/bin/lxqt-notificationd &
    fi

    if [ -x /usr/bin/start-pulseaudio-x11 ] ; then
        /usr/bin/start-pulseaudio-x11
        if [ -x /usr/bin/pasystray ] ; then
            /usr/bin/pasystray &
        elif [ -x /usr/bin/mate-volume-control-applet ] ; then
            /usr/bin/mate-volume-control-applet &
        fi
    fi

    if [ -x /usr/bin/gnome-keyring-daemon ] ; then
        eval `/usr/bin/gnome-keyring-daemon --start`
        export GNOME_KEYRING_CONTROL GPG_AGENT_INFO SSH_AUTH_SOCK
    fi

    [ -x /usr/bin/krb5-auth-dialog ] && /usr/bin/krb5-auth-dialog &

    if [ -x /usr/libexec/evolution/3.14/evolution-alarm-notify ] ; then
        /usr/libexec/evolution/3.14/evolution-alarm-notify &
    elif [ -x /usr/libexec/evolution/3.10/evolution-alarm-notify ] ; then
        /usr/libexec/evolution/3.10/evolution-alarm-notify &
    fi

    [ -x /usr/bin/seahorse-sharing ] && /usr/bin/seahorse-sharing &
    [ -x /usr/bin/zeitgeist-datahub ] && /usr/bin/zeitgeist-datahub &
    #[ -x /usr/bin/xterm ] && /usr/bin/xterm &
    [ -x /usr/bin/fbxkb ] && /usr/bin/fbxkb &
    #[ -x /usr/bin/fbpanel ] && exec /usr/bin/fbpanel -p multiwindow
    #[ -x /usr/bin/xwin-xdg-menu ] && exec /usr/bin/xwin-xdg-menu
    [ -x /usr/bin/sleep ] && exec /usr/bin/sleep infinity
fi
-- SNAP

Since "$HOME/.startxwinrc" does not exist", and "/usr/bin/sleep"
exists, "/usr/bin/sleep" shall be executed with argument "infinity",
keeping XWin up and running, without starting any client.

But it just doesn't work. /etc/X11/xinit/startxwinrc seems never to execute.

-- 
Thomas

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: XWin Server starts but terminates shortly after
  2015-11-12 10:11 XWin Server starts but terminates shortly after Thomas Schweikle
@ 2015-11-12 14:42 ` Jon Turney
  2015-11-17 15:13   ` Jon Turney
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Turney @ 2015-11-12 14:42 UTC (permalink / raw)
  To: Thomas Schweikle, cygwin

On 12/11/2015 10:11, Thomas Schweikle wrote:
> Since about six months: I can start XWin-Server, but it terminates
> shortly after without any chance to start any X11-application.

I assume this [1] is your initial report, back in September.

I asked you some follow up questions [2], but I didn't get any reply.

[1] https://cygwin.com/ml/cygwin/2015-09/msg00084.html
[2] https://cygwin.com/ml/cygwin/2015-09/msg00186.html

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: XWin Server starts but terminates shortly after
  2015-11-12 14:42 ` Jon Turney
@ 2015-11-17 15:13   ` Jon Turney
  2015-11-19 20:21     ` Jon Turney
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Turney @ 2015-11-17 15:13 UTC (permalink / raw)
  To: cygwin; +Cc: Thomas Schweikle

On 12/11/2015 14:42, Jon Turney wrote:
> On 12/11/2015 10:11, Thomas Schweikle wrote:
>> Since about six months: I can start XWin-Server, but it terminates
>> shortly after without any chance to start any X11-application.
>
> I assume this [1] is your initial report, back in September.
>
> I asked you some follow up questions [2], but I didn't get any reply.
>
> [1] https://cygwin.com/ml/cygwin/2015-09/msg00084.html
> [2] https://cygwin.com/ml/cygwin/2015-09/msg00186.html

For the record, the OP replied to me:

On 13/11/2015 15:13, Thomas Schweikle wrote:
 > Adding "-nowgl" does the trick. XWin is running again.

It seems that this problem manifests itself when running on a Windows 
guest under VMWare, with their SVGA driver.

This seems to be caused by a c0000374 (STATUS_HEAP_CORRUPTION) exception 
raised whilst loading the VMWare OpenGL driver.

> Critical error detected c0000374
[...]
> Child-SP          RetAddr           Call Site
> 00000000`0022aab0 00000000`77754746 ntdll!RtlReportCriticalFailure+0x2f
> 00000000`0022ab80 00000000`77755952 ntdll!RtlpReportHeapFailure+0x26
> 00000000`0022abb0 00000000`77757604 ntdll!RtlpHeapHandleError+0x12
> 00000000`0022abe0 00000000`776fdc1f ntdll!RtlpLogHeapFailure+0xa4
> 00000000`0022ac10 00000000`77591a4a ntdll! ?? ::FNODOBFM::`string'+0x10c54
> 00000000`0022ac90 000007fe`eae466ec kernel32!HeapFree+0xa
> 00000000`0022acc0 000007fe`ea0f5db8 vm3dgl64!wglRealizeLayerPalette+0x90a2ec
> 00000000`0022acf0 000007fe`ea0f5e0b vm3dgl64+0x15db8
> 00000000`0022b720 000007fe`ea130739 vm3dgl64+0x15e0b
> 00000000`0022b750 000007fe`ea0f08e8 vm3dgl64+0x50739
> 00000000`0022b780 000007fe`eae46b5a vm3dgl64+0x108e8
> 00000000`0022b7b0 00000000`776cb108 vm3dgl64!wglRealizeLayerPalette+0x90a75a
> 00000000`0022b820 00000000`776b787a ntdll!LdrpRunInitializeRoutines+0x1fe
> 00000000`0022b9f0 00000000`776b7b5e ntdll!LdrpLoadDll+0x231
> 00000000`0022bc00 000007fe`fd6e9059 ntdll!LdrLoadDll+0x9a
> 00000000`0022bc70 000007fe`ee4e7b61 KERNELBASE!LoadLibraryExW+0x22e
> 00000000`0022bce0 000007fe`ee4e7f93 OPENGL32!wglCbGetDdHandle+0x51
> 00000000`0022bd30 000007fe`ee4fa976 OPENGL32!wglCbGetDdHandle+0x483
> 00000000`0022c390 000007fe`ee4f9c2a OPENGL32!wglDescribePixelFormat+0x126
> 00000000`0022c490 000007fe`fd84997a OPENGL32!wglChoosePixelFormat+0x7a
> 00000000`0022c530 00000001`0042d2de GDI32!ChoosePixelFormat+0x4e
> 00000000`0022c560 00000001`00495ce7 XWin!WindowsDRIExtensionInit+0x21ae
> 00000000`0022c980 00000001`00414503 XWin!GlxExtensionInit+0x167
> 00000000`0022ca00 00000001`0051df8e XWin!InitExtensions+0x43
> 00000000`0022ca40 00000001`8004836d XWin!dix_main+0x1de
> 00000000`0022cae0 00000001`8004607c cygwin1!cygwin_dll_init+0x113d
> 00000000`0022cc70 00000001`80046114 cygwin1!setprogname+0x35ec
> 00000000`0022ccd0 00000001`0057dbf1 cygwin1!setprogname+0x3684
> 00000000`0022ff00 00000001`00401010 XWin!XNFprintf+0x1451
> 00000000`0022ff30 00000000`775859ed XWin+0x1010
> 00000000`0022ff60 00000000`776bc541 kernel32!BaseThreadInitThunk+0xd
> 00000000`0022ff90 00000000`00000000 ntdll!RtlUserThreadStart+0x1d


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: XWin Server starts but terminates shortly after
  2015-11-17 15:13   ` Jon Turney
@ 2015-11-19 20:21     ` Jon Turney
  0 siblings, 0 replies; 4+ messages in thread
From: Jon Turney @ 2015-11-19 20:21 UTC (permalink / raw)
  To: cygwin; +Cc: Thomas Schweikle

[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]

On 17/11/2015 15:13, Jon Turney wrote:
> On 13/11/2015 15:13, Thomas Schweikle wrote:
>> Adding "-nowgl" does the trick. XWin is running again.
>
> It seems that this problem manifests itself when running on a Windows
> guest under VMWare, with their SVGA driver.
>
> This seems to be caused by a c0000374 (STATUS_HEAP_CORRUPTION) exception
> raised whilst loading the VMWare OpenGL driver.

This is easy to reduce to just the code that XWin uses to probe the 
capabilities of the native OpenGL renderer (attached).

$ gcc -Wall xwin-gl-probe.c -lgdi32 -lopengl32 -o xwin-gl-probe.exe

$ strace ./xwin-gl-probe.exe
[...]
--- Process 2356, exception c0000374 at 0000000077B64102
[...]

If I add a checking with HeapValidate() before the crashing call to 
ChoosePixelFormat(), that doesn't report any problems, so that seems to 
rule out the heap corruption being introduced by this code.

Compiling the same code with VS 2013 works without problems on my test 
VM (VMWare Player 12.0.1 + W7 x64 + VMWare SVGA driver)

This doesn't really get me any further forward though.  Does this crash 
loading vm3dgl64 because of a bug in vm3dgl64 which is only exposed in 
Cygwin? or because the Cygwin environment doesn't satisfy some 
requirement of vm3dgl64 that it should?

This isn't the first report of a crash in this probe with various 
graphics drivers (although typically the exception is c0000005, which we 
can catch and fallback to software rendering), so while it's tempting to 
assume this is a problem in the graphics driver, it's possible that 
something systematic is wrong.

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

[-- Attachment #2: xwin-gl-probe.c --]
[-- Type: text/plain, Size: 2710 bytes --]

//
// gcc xwin-gl-probe.c -lgdi32 -lopengl32 -o xwin-gl-probe.exe -Wall
//

#include <stdio.h>
#include <windows.h>

int
main(void)
{
    HWND hwnd;
    HDC hdc;
    HGLRC hglrc;

    // create window class
#define WIN_GL_TEST_WINDOW_CLASS L"XWinGLTest"
    {
        static ATOM glTestWndClass = 0;

        if (glTestWndClass == 0) {
            WNDCLASSEXW wc;

            wc.cbSize = sizeof(WNDCLASSEX);
            wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
            wc.lpfnWndProc = DefWindowProc;
            wc.cbClsExtra = 0;
            wc.cbWndExtra = 0;
            wc.hInstance = GetModuleHandle(NULL);
            wc.hIcon = 0;
            wc.hCursor = 0;
            wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
            wc.lpszMenuName = NULL;
            wc.lpszClassName = WIN_GL_TEST_WINDOW_CLASS;
            wc.hIconSm = 0;
            RegisterClassExW(&wc);
        }
    }

   // create an invisible window for a scratch DC
   hwnd = CreateWindowExW(0,
                           WIN_GL_TEST_WINDOW_CLASS,
                           L"XWin GL Renderer Capabilities Test Window",
                           WS_OVERLAPPEDWINDOW|WS_VISIBLE, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL),
                           NULL);
    if (hwnd == NULL) {
        printf("Couldn't create a window for render capabilities testing\n");
        goto error;
    }

    hdc = GetDC(hwnd);
    if (!hdc) {
        printf("Couldn't create a DC for render capabilities testing\n");
        goto error;
    }

    // we must set a pixel format before we can create a context
    {
        PIXELFORMATDESCRIPTOR pfd = {
            sizeof(PIXELFORMATDESCRIPTOR),
            1,
            PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DEPTH_DONTCARE | PFD_DOUBLEBUFFER_DONTCARE | PFD_STEREO_DONTCARE,
            PFD_TYPE_RGBA,
            24,
            0, 0, 0, 0, 0, 0,
            0,
            0,
            0,
            0, 0, 0, 0,
            0,
            0,
            0,
            PFD_MAIN_PLANE,
            0,
            0, 0, 0
        };

        int iPixelFormat = ChoosePixelFormat(hdc, &pfd);
        if (iPixelFormat == 0) {
            printf("ChoosePixelFormat failed\n");
            goto error;
        }

        if (!SetPixelFormat(hdc, iPixelFormat, NULL)) {
            printf("SetPixelFormat %d failed\n", iPixelFormat);
            goto error;
        }
        printf("Testing pixelFormatIndex %d\n",iPixelFormat);
    }

    hglrc = wglCreateContext(hdc);
    if (!wglMakeCurrent(hdc, hglrc)) {
        printf("wglMakeCurrent error: %08x dc %p ctx %p\n", (unsigned)GetLastError(), hdc, hglrc);
    }

    printf("Done\n");
error:
    return 0;
}

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-19 20:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12 10:11 XWin Server starts but terminates shortly after Thomas Schweikle
2015-11-12 14:42 ` Jon Turney
2015-11-17 15:13   ` Jon Turney
2015-11-19 20:21     ` Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).