Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Segmentation Fault - SFML2  (Read 12276 times)

0 Members and 2 Guests are viewing this topic.

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
Segmentation Fault - SFML2
« on: January 02, 2011, 06:17:05 pm »
I get a segmantation fault when closing a SFML window-application.

Im using sfml 2 on a 64bit linux.
Quote

XIO: fatal IO error 11 (Resource temporarily unavailable) on X server "��
      after 7131 requests (7130 known processed) with 0 events remaining.
Segmentation fault


Not sure what it means exactly

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Segmentation Fault - SFML2
« Reply #1 on: January 02, 2011, 07:52:12 pm »
Don't you have a radeon graphics card? AFAIK, there are some problems with linux radeon drivers.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Segmentation Fault - SFML2
« Reply #2 on: January 02, 2011, 08:38:24 pm »
Only on Windows, as far as I know.
Laurent Gomila - SFML developer

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
Segmentation Fault - SFML2
« Reply #3 on: January 02, 2011, 08:50:27 pm »
It is a Radeon 4870 with fglrx driver.
Opengl Version 3.3.xxx
GLSL 3.3

deathbuffer

  • Newbie
  • *
  • Posts: 9
    • View Profile
Segmentation Fault - SFML2
« Reply #4 on: June 20, 2011, 05:08:53 pm »
I have the same problem, with SFML 2 from Github.
Using Ubuntu 10.10 with an ATI card:
Renderer: ATI Radeon HD 4300/4500 Series
Version: 3.3.10237 Compatibility Profile Context

Error is:
Code: [Select]

XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server "PX6"
      after 152 requests (151 known processed) with 0 events remaining.


Here is my stack trace:

Code: [Select]

#8  0x00007ffff5d967f4 in _XDefaultIOError () from /usr/lib/libX11.so.6
#9  0x00007ffff5d9686e in _XIOError () from /usr/lib/libX11.so.6
#10 0x00007ffff5d9e415 in ?? () from /usr/lib/libX11.so.6
#11 0x00007ffff5d9e9b0 in _XReply () from /usr/lib/libX11.so.6
#12 0x00007ffff5d8bdbd in XQueryExtension () from /usr/lib/libX11.so.6
#13 0x00007ffff5d80202 in XInitExtension () from /usr/lib/libX11.so.6
#14 0x00007ffff5933782 in XextAddDisplay () from /usr/lib/libXext.so.6
#15 0x00007ffff7e61fbb in AtiCallFGLComposite () from /usr/lib/fglrx/libGL.so.1
#16 0x00007ffff0d4eb73 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#17 0x00007ffff0da4c84 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#18 0x00007ffff0b80b26 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#19 0x00007ffff0405fd8 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#20 0x00007fffef9b5a23 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#21 0x00007fffefa67cf7 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#22 0x00007fffefa67e69 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#23 0x00007ffff040b2bd in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#24 0x00007ffff0d51df7 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#25 0x00007ffff0d52751 in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#26 0x00007ffff0d527ad in ?? () from /usr/lib/fglrx/dri/fglrx_dri.so
#27 0x00007ffff7e3c909 in ?? () from /usr/lib/fglrx/libGL.so.1
#28 0x00007ffff7e3c94a in ?? () from /usr/lib/fglrx/libGL.so.1
#29 0x00007ffff5d782d5 in _XFreeExtData () from /usr/lib/libX11.so.6
#30 0x00007ffff5d8590d in _XFreeDisplayStructure () from /usr/lib/libX11.so.6
#31 0x00007ffff5d70eaf in XCloseDisplay () from /usr/lib/libX11.so.6
#32 0x000000000327d59a in sf::priv::WindowImplX11::~WindowImplX11 (this=0x5129b10, __in_chrg=<value optimized out>)
    at ../../../externals/sfml/src/SFML/Window/Linux/WindowImplX11.cpp:268
#33 0x000000000327d609 in sf::priv::WindowImplX11::~WindowImplX11 (this=0x5129b10, __in_chrg=<value optimized out>)
    at ../../../externals/sfml/src/SFML/Window/Linux/WindowImplX11.cpp:269
#34 0x000000000327256a in sf::Window::Close (this=0x4b66b70) at ../../../externals/sfml/src/SFML/Window/Window.cpp:160
#35 0x000000000324190c in scape::sfml::SFMLDisplay::close (this=0x4b826a0) at ../../../scape/modules/sfml/sfmldisplay.cpp:126


Any ideas?
Thanks!
[/code]
Engine programmer at Black Pants Studio
http://tinyandbig.com

deathbuffer

  • Newbie
  • *
  • Posts: 9
    • View Profile
Segmentation Fault - SFML2
« Reply #5 on: June 20, 2011, 05:51:33 pm »
I just tested on a Mint 11 (Gnome, 64bit) with a Radeon HD 5750:
Renderer: ATI Radeon HD 5700 Series
Version: 4.1.10665 Compatibility Profile Context

Works fine here, so it's seems to be driver-related, like you mentioned in another topic. Thing is, it works on the bad driver when I use SDL 1.2. Either SDL is using a different X11 interface, or it has some kind of workaround for this bug.
So is this bug supposed to be fixed in SFML 2? I'd really hate going back to SDL...

Thanks so much, SFML 2 is awesome, and otherwise really stable for pre-release software!
Engine programmer at Black Pants Studio
http://tinyandbig.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Segmentation Fault - SFML2
« Reply #6 on: June 20, 2011, 06:10:40 pm »
SDL 1.2 doesn't use OpenGL at all. Try SDL 1.3 with the "OpenGL" renderer instead.
Laurent Gomila - SFML developer

deathbuffer

  • Newbie
  • *
  • Posts: 9
    • View Profile
Segmentation Fault - SFML2
« Reply #7 on: June 20, 2011, 07:12:17 pm »
Thanks for the quick reply!
What I actually meant was that SDL 1.2 creates an OpenGL context if you pass it the SDL_OPENGL flag. I'm using SFML (and previously SDL) just for giving me a window with an OpenGL context on Mac and Linux. All the rendering is done using OpenGL directly, so for me the difference between SDL and SFML is just how the X11 window and the OpenGL context are handled.
Engine programmer at Black Pants Studio
http://tinyandbig.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Segmentation Fault - SFML2
« Reply #8 on: June 20, 2011, 07:19:30 pm »
Oh ok, I see.
Laurent Gomila - SFML developer

deathbuffer

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Segmentation Fault - SFML2
« Reply #9 on: July 30, 2012, 04:56:10 pm »
Sorry for the thread necromancy, but I still see this bug in SFML 2 RC1. This time on a Ubuntu 10.10 box with a GeForce 8400GS and Nvidia drivers 260.19.06.

The strange thing is, that it crashes even if I don't use SFML at all. I have a statically linked binary with both SDL and SFML (don't ask). Only SDL code is used, and I get the crash after closing the SDL window. If I link the executable without SFML, or with SFML 1.6, everything's fine.
Engine programmer at Black Pants Studio
http://tinyandbig.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Segmentation Fault - SFML2
« Reply #10 on: July 30, 2012, 07:16:18 pm »
Can you show the stack trace?
Laurent Gomila - SFML developer

deathbuffer

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Segmentation Fault - SFML2
« Reply #11 on: July 31, 2012, 06:13:25 pm »
Should've mentioned the program doesn't crash, it just calls exit(), returning 1 as exit code. This makes my automated tests fail, so to me it's as bad as a crash. Judging from the stack trace, it seems the X11 calls fail because they're happening too late in the static deinitialization phase.

#1  0x00007ffff57fe1d4 in _XDefaultIOError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#2  0x00007ffff57fe41e in _XIOError () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#3  0x00007ffff57fc38b in _XReply () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#4  0x00007ffff57f7aed in XSync () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#5  0x00007ffff57d8810 in XCloseDisplay () from /usr/lib/x86_64-linux-gnu/libX11.so.6
#6  0x0000000004aa9b75 in (anonymous namespace)::GlobalDisplay::~GlobalDisplay (this=0x64f9d30, __in_chrg=<optimized out>) at ../../../externals/sfml/src/SFML/Window/Linux/InputImpl.cpp:47
#7  0x00007ffff5142921 in __run_exit_handlers (status=0, listp=0x7ffff54bd688, run_list_atexit=true) at exit.c:78
#8  0x00007ffff51429a5 in __GI_exit (status=<optimized out>) at exit.c:100
#9  0x00007ffff5128774 in __libc_start_main (main=0x38903f9 <main(int, char const* const*)>, argc=2, ubp_av=0x7fffffffe278, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>,
    stack_end=0x7fffffffe268) at libc-start.c:258
#10 0x000000000388f865 in _start ()
Engine programmer at Black Pants Studio
http://tinyandbig.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Segmentation Fault - SFML2
« Reply #12 on: July 31, 2012, 08:35:11 pm »
I thought there was no more X11 Display used in global scope, but there's still one used for global inputs (sf::Mouse and sf::Keyboard). I wish there was a cleaner solution, but I haven't found one yet.

However it seems from your stack trace that a X11 error is triggered, don't you have a debug message in the standard output?
Laurent Gomila - SFML developer

deathbuffer

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Segmentation Fault - SFML2
« Reply #13 on: August 01, 2012, 11:21:36 am »
Yes, the debug message is the same as for the original poster (minus segfault), that's why I resurrected this thread in the first place:

Code: [Select]
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0"
      after 8 requests (6 known processed) with 0 events remaining.

When I run the app so that SDL doesn't create a window, the process exits successfully without any debug messages. This means this problem is very specific to my build, but it also means I cannot use SFML in my projects, as it has to quietly coexist with other libraries. I know it's a difficult design choice, but if I had to decide it I wouldn't do things like calling X11 without the host app being able to do anything about it. Just my 2 cents, though.

Thanks!
Engine programmer at Black Pants Studio
http://tinyandbig.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Segmentation Fault - SFML2
« Reply #14 on: August 01, 2012, 12:21:50 pm »
Quote
I know it's a difficult design choice, but if I had to decide it I wouldn't do things like calling X11 without the host app being able to do anything about it.
That sounds wise, but what modifications would it involve in the API? How would you handle that in code?
Laurent Gomila - SFML developer