You are not logged in.

#1 2014-03-09 19:06:31

Chaosed0
Member
Registered: 2013-09-27
Posts: 10

SFML: xcb_wait_for_reply deadlock

(Cross-posted from the SFML forums, with a few edits)

I'm developing an application using SFML under Archlinux. I'm getting an error just creating and displaying window. Here's the code I'm running:

#include <SFML/Network.hpp>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <stdio.h>

void SFMLWindowTest() {
	sf::RenderWindow window;
	bool running = true;
	sf::Time minFrameTime = sf::seconds(1) / sf::Int64(60);
	sf::Clock frameClock;

	window.create(sf::VideoMode(800, 600, 24), "SFML window", sf::Style::Resize | sf::Style::Close);

	while(running) {
		printf("Running\n");

		sf::Event anEvent;
		while(window.pollEvent(anEvent)) {
			if(anEvent.type == sf::Event::Closed) {
				running = false;
			}
		}
		window.clear();
		window.display();

		if(frameClock.getElapsedTime() < minFrameTime) {
			sf::sleep(minFrameTime - frameClock.getElapsedTime());
		}

		frameClock.restart();
	}
}

int main() {
	SFMLWindowTest();
	return 0;
}

The run loop spits out "Running" exactly three times and then deadlocks. Here's the output from gdb (some newlines added for emphasis):

[chaosed0@ChaosArch whateven]$ gdb bin/test
GNU gdb (GDB) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from bin/test...done.

(gdb) r

Starting program: /home/chaosed0/Code/whateven/bin/test 
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Running
Running
Running

<EXECUTION STOPS HERE, AFTER SEVERAL SECONDS I INTERRUPT IT>

^C
Program received signal SIGINT, Interrupt.
0x00007ffff6a21340 in __poll_nocancel () from /usr/lib/libc.so.6
(gdb) bt

#0  0x00007ffff6a21340 in __poll_nocancel () from /usr/lib/libc.so.6
#1  0x00007ffff2e68992 in poll (__timeout=-1, __nfds=1, __fds=0x7fffffffe0e0) at /usr/include/bits/poll2.h:46
#2  _xcb_conn_wait (c=c@entry=0x466790, cond=cond@entry=0x7fffffffe200, vector=vector@entry=0x0, count=count@entry=0x0) at xcb_conn.c:447
#3  0x00007ffff2e6a21f in wait_for_reply (c=c@entry=0x466790, request=91, e=e@entry=0x7fffffffe2c8) at xcb_in.c:490
#4  0x00007ffff2e6a332 in xcb_wait_for_reply (c=0x466790, request=91, e=0x7fffffffe2c8) at xcb_in.c:520
#5  0x00007ffff5837117 in _XReply () from /usr/lib/libX11.so.6
#6  0x00007ffff5f985d3 in ?? () from /usr/lib/libGL.so.1
#7  0x00007ffff5f95f6b in ?? () from /usr/lib/libGL.so.1
#8  0x00007ffff0fb76db in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
#9  0x00007ffff0fb7a33 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
#10 0x00007ffff0fac6e5 in ?? () from /usr/lib/xorg/modules/dri/i965_dri.so
#11 0x00007ffff7bb62ae in sf::RenderTarget::clear (this=0x7fffffffe670, color=...) at /home/chaosed0/Code/SFML/src/SFML/Graphics/RenderTarget.cpp:62
#12 0x00000000004044cc in SFMLWindowTest () at test.cpp:28
#13 0x0000000000404aa4 in main () at test.cpp:67

The same behavior does not occur right away if I try to use sf::VideoMode::getDesktopMode() in place of my custom video mode. However, if I resize the window in certain ways, it will lock up in the exact same place. I say "in certain ways" because I haven't figured out exactly when it happens; all I know is that if I resize it from the top-left, it's fine, but if I resize it from the bottom-right, it locks up.

Here's some information about my system:

  • OS: Arch with kernel 3.13.6-1

  • X Version: 1.15.0, built from ABS source

  • XCB Version: 1.10-1, built from ABS source, debug version

  • SFML Version: 2.1, built from source from the github repo, debug version (also tried SFML 2.1 from the arch package repositories)

  • Desktop environment/WM: XMonad, also tried under LXDE/OpenBox

  • Compiler: Tried both Clang++ 3.4 final and g++ 4.8.2 20140206 (prerelease)

As noted at the top, I also posted the problem to the SFML forums, but it doesn't look like an SFML-specific issue. Having never used the X11 libraries in raw form, I have no idea how to begin to diagnose the problem. It could be so many things, only a few of which I have direct knowledge of. Well, anyway, hopefully someone can at least point me in the right direction.

Last edited by Chaosed0 (2014-03-11 14:38:01)

Offline

#2 2014-03-11 14:38:59

Chaosed0
Member
Registered: 2013-09-27
Posts: 10

Re: SFML: xcb_wait_for_reply deadlock

Would someone mind moving this to the "Programming and Scripting" forum? I didn't realize that it existed, and it might be more appropriate.

Offline

Board footer

Powered by FluxBB