Opened 8 years ago

Closed 8 years ago

#51911 closed defect (fixed)

libepoxy: crash in gtk_init_check when calling epoxy_glx_version

Reported by: manus@… Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: libepoxy

Description (last modified by dbevans (David B. Evans))

I'm migrating an application from GTK2 to GTK3 and while it launches when using XQuartz, it fails when trying to use an X server running on a different machine (Windows using Xming 7.5.010).

The trace is:

(lldb) bt
* thread #1: tid = 0x4f66, 0x00007fff99272132 libsystem_c.dylib`strlen + 18, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00007fff99272132 libsystem_c.dylib`strlen + 18
    frame #1: 0x00007fff992c4d2f libsystem_c.dylib`vsscanf_l + 357
    frame #2: 0x00007fff992b5053 libsystem_c.dylib`sscanf + 186
    frame #3: 0x0000000111fe97b0 libepoxy.0.dylib`epoxy_glx_version + 55
    frame #4: 0x000000011102c286 libgdk-3.0.dylib`gdk_x11_screen_init_gl + 132
    frame #5: 0x000000011102c6bc libgdk-3.0.dylib`_gdk_x11_screen_update_visuals_for_gl + 398
    frame #6: 0x0000000111035065 libgdk-3.0.dylib`_gdk_x11_screen_init_visuals + 1114
    frame #7: 0x0000000111031862 libgdk-3.0.dylib`_gdk_x11_screen_new + 244
    frame #8: 0x0000000111024004 libgdk-3.0.dylib`_gdk_x11_display_open + 384
    frame #9: 0x0000000111001b36 libgdk-3.0.dylib`gdk_display_manager_open_display + 383
    frame #10: 0x0000000110b1d8a9 libgtk-3.0.dylib`gtk_init_check + 19
    frame #11: 0x000000010b7739e1 ec`F2124_36756 + 465
    frame #12: 0x000000010b74baad ec`F2124_36637 + 2381
    frame #13: 0x000000010b71857d ec`F2118_36485 + 2061
    frame #14: 0x000000010b715c9c ec`F2118_36473 + 2028
    frame #15: 0x000000010bc9eb1d ec`F1910_33151 + 1197
    frame #16: 0x000000010bc43b4d ec`F1896_32888 + 701
    frame #17: 0x00000001078d8e25 ec`F3984_69385 + 997
    frame #18: 0x000000010be5a2b4 ec`F1841_30960 + 2356
    frame #19: 0x000000010e03b7b7 ec`emain + 343
    frame #20: 0x000000010e04d894 ec`main + 164
    frame #21: 0x00007fff9517f5ad libdyld.dylib`start + 1

Change History (11)

comment:1 Changed 8 years ago by manus@…

comment:2 Changed 8 years ago by manus@…

Could not modify the original submission for a better formatting of the trace, so here it is:

Stack Trace:

* thread #1: tid = 0x8dff, 0x00007fff99272132 libsystem_c.dylib`strlen + 18, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00007fff99272132 libsystem_c.dylib`strlen + 18
    frame #1: 0x00007fff992c4d2f libsystem_c.dylib`vsscanf_l + 357
    frame #2: 0x00007fff992b5053 libsystem_c.dylib`sscanf + 186
    frame #3: 0x0000000111fe97b0 libepoxy.0.dylib`epoxy_glx_version + 55
    frame #4: 0x000000011102c286 libgdk-3.0.dylib`gdk_x11_screen_init_gl + 132
    frame #5: 0x000000011102c6bc libgdk-3.0.dylib`_gdk_x11_screen_update_visuals_for_gl + 398
    frame #6: 0x0000000111035065 libgdk-3.0.dylib`_gdk_x11_screen_init_visuals + 1114
    frame #7: 0x0000000111031862 libgdk-3.0.dylib`_gdk_x11_screen_new + 244
    frame #8: 0x0000000111024004 libgdk-3.0.dylib`_gdk_x11_display_open + 384
    frame #9: 0x0000000111001b36 libgdk-3.0.dylib`gdk_display_manager_open_display + 383
    frame #10: 0x0000000110b1d8a9 libgtk-3.0.dylib`gtk_init_check + 19
    frame #11: 0x000000010b7739e1 ec`F2124_36756 + 465
    frame #12: 0x000000010b74baad ec`F2124_36637 + 2381
    frame #13: 0x000000010b71857d ec`F2118_36485 + 2061
    frame #14: 0x000000010b715c9c ec`F2118_36473 + 2028
    frame #15: 0x000000010bc9eb1d ec`F1910_33151 + 1197
    frame #16: 0x000000010bc43b4d ec`F1896_32888 + 701
    frame #17: 0x00000001078d8e25 ec`F3984_69385 + 997
    frame #18: 0x000000010be5a2b4 ec`F1841_30960 + 2356
    frame #19: 0x000000010e03b7b7 ec`emain + 343
    frame #20: 0x000000010e04d894 ec`main + 164
    frame #21: 0x00007fff9517f5ad libdyld.dylib`start + 1

comment:3 Changed 8 years ago by dbevans (David B. Evans)

Owner: changed from macports-tickets@… to devans@…
Port: libepoxy added
Status: newassigned
Summary: Crash in gtk_init_checklibepoxy: crash in gtk_init_check when calling epoxy_glx_version

This does appear to be an instance of the problem discussed in upstream github issue 72. The implication is that your remote server does not support GLX. But there definitely should be better error handling here. Will review upstream suggestions and see what can be done.

comment:4 Changed 8 years ago by dbevans (David B. Evans)

Description: modified (diff)

comment:5 Changed 8 years ago by dbevans (David B. Evans)

Tentative patch added in r150697 to stop expoxy_glx_version from crashing when either client or server does not support GLX.

Taken from

https://github.com/yaronct/libepoxy/commit/b3b8bd9af7bf1fcfe544fd131f4d4f0d117ae7bc

which claims to fix https://github.com/anholt/libepoxy/issues/72. Please update libepoxy and let me know if this fixes your issue or send more debugging info if it does not.

comment:6 Changed 8 years ago by manus@…

Thanks for doing this. I did an update on my port and got the following update which succeeded:

Attempting to fetch libepoxy-1.3.1_2+python34.darwin_15.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/libepoxy

Unfortunately this doesn't fix the problem, but the behavior changed:

(lldb) bt
* thread #1: tid = 0x216596, 0x00007fff992cd2e9 libsystem_c.dylib`strstr + 42, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00007fff992cd2e9 libsystem_c.dylib`strstr + 42
    frame #1: 0x0000000111fb7194 libepoxy.0.dylib`epoxy_extension_in_string + 38
    frame #2: 0x000000011102c2b6 libgdk-3.0.dylib`gdk_x11_screen_init_gl + 180
    frame #3: 0x000000011102c6bc libgdk-3.0.dylib`_gdk_x11_screen_update_visuals_for_gl + 398
    frame #4: 0x0000000111035065 libgdk-3.0.dylib`_gdk_x11_screen_init_visuals + 1114
    frame #5: 0x0000000111031862 libgdk-3.0.dylib`_gdk_x11_screen_new + 244
    frame #6: 0x0000000111024004 libgdk-3.0.dylib`_gdk_x11_display_open + 384
    frame #7: 0x0000000111001b36 libgdk-3.0.dylib`gdk_display_manager_open_display + 383
    frame #8: 0x0000000110b1d8a9 libgtk-3.0.dylib`gtk_init_check + 19
    frame #9: 0x000000010b7739e1 ec`F2124_36756 + 465
    frame #10: 0x000000010b74baad ec`F2124_36637 + 2381
    frame #11: 0x000000010b71857d ec`F2118_36485 + 2061
    frame #12: 0x000000010b715c9c ec`F2118_36473 + 2028
    frame #13: 0x000000010bc9eb1d ec`F1910_33151 + 1197
    frame #14: 0x000000010bc43b4d ec`F1896_32888 + 701
    frame #15: 0x00000001078d8e25 ec`F3984_69385 + 997
    frame #16: 0x000000010be5a2b4 ec`F1841_30960 + 2356
    frame #17: 0x000000010e03b7b7 ec`emain + 343
    frame #18: 0x000000010e04d894 ec`main + 164
    frame #19: 0x00007fff9517f5ad libdyld.dylib`start + 1

Is there a way to get the source code you used so that I can compile it locally and run lldb against this?

comment:7 Changed 8 years ago by manus@…

Found the issue, in https://github.com/anholt/libepoxy/blob/master/src/dispatch_glx.c#L104 the call to glXQueryExtensionsString returns NULL and not an empty string.

The call in epoxy_extension_in_string does not check for that. So checking that the extension_list is null would simply fix the issue:

https://github.com/anholt/libepoxy/blob/master/src/dispatch_common.c#L350

comment:9 Changed 8 years ago by dbevans (David B. Evans)

Committed the contents of your PR as a patch in r150809. Let me know if this closes out this ticket or if there are additional issues.

Concerning the location of the source for debugging purposes, port extracts the tarball into the port's working directory which can be found, after patching, as follows:

$ sudo port patch libepoxy
$ port work libepoxy
/opt/local/var/macports/build/_opt_macports_trunk_dports_graphics_libepoxy/libepoxy/work

The exact path will depend on the details of your installation.

To rebuild the port locally (rather than using the precompiled binary) with debugging symbols, I recommend the following commands:

$ cd $(port dir libepoxy)
$ sudo port clean
$ sudo port -nsk upgrade --force configure.optflags='-g -O0'
$ lldb <your app to debug linked to libepoxy>

comment:10 Changed 8 years ago by manus@…

So far so good. It works!

Thank you so much.

Thanks for the instructions too. Next time I have an issue with a package, I will remember them.

comment:11 Changed 8 years ago by dbevans (David B. Evans)

Resolution: fixed
Status: assignedclosed
Version: 2.3.4

Thanks, as well, for your help in spotting this neglected case and coming up with the solution. Closing this ticket.

Note: See TracTickets for help on using tickets.