WizardCorp / WizardPoker

An online free-to-play card game
http://www.wizardcorp.com/wizardpoker
0 stars 0 forks source link

SIGSEGV when running two GUI games #155

Open RobinPetit opened 8 years ago

RobinPetit commented 8 years ago

Issue by TheoVerhelst Saturday Mar 26, 2016 at 17:00 GMT Originally opened as https://github.com/ulb-infof209/Group5/issues/155


Branch: #148 affd1977c9c52a06aaa29fcd778c52b65da56a38 The bug occurs when two GUI clients start a game together, gdb says:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe7fff700 (LWP 10901)]
0x00007ffff5b1588f in _int_malloc (av=av@entry=0x7fffe0000020, bytes=bytes@entry=8) at malloc.c:3326
3326    malloc.c: No such file or directory.
(gdb) bt
#0  0x00007ffff5b1588f in _int_malloc (av=av@entry=0x7fffe0000020, bytes=bytes@entry=8) at malloc.c:3326
#1  0x00007ffff5b184ae in __GI___libc_malloc (bytes=8) at malloc.c:2895
#2  0x00007ffff6103188 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff797509d in (anonymous namespace)::getInternalContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:159
#4  0x00007ffff79753f7 in sf::priv::GlContext::ensureContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:217
#5  0x00007ffff7977738 in sf::GlResource::GlResource (this=0x7fffe0157050)
    at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlResource.cpp:60
#6  0x00007ffff79734e9 in sf::Context::Context (this=0x7fffe0157050) at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/Context.cpp:60
#7  0x00007ffff79750a8 in (anonymous namespace)::getInternalContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:159
#8  0x00007ffff79753f7 in sf::priv::GlContext::ensureContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:217
#9  0x00007ffff7977738 in sf::GlResource::GlResource (this=0x7fffe0157030)
    at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlResource.cpp:60
#10 0x00007ffff79734e9 in sf::Context::Context (this=0x7fffe0157030) at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/Context.cpp:60
#11 0x00007ffff79750a8 in (anonymous namespace)::getInternalContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:159
#12 0x00007ffff79753f7 in sf::priv::GlContext::ensureContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:217
#13 0x00007ffff7977738 in sf::GlResource::GlResource (this=0x7fffe0157010)
    at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlResource.cpp:60
#14 0x00007ffff79734e9 in sf::Context::Context (this=0x7fffe0157010) at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/Context.cpp:60
#15 0x00007ffff79750a8 in (anonymous namespace)::getInternalContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:159
#16 0x00007ffff79753f7 in sf::priv::GlContext::ensureContext () at /home/theo/cpp/Bibliothèques/SFML-master/src/SFML/Window/GlContext.cpp:217
#17 0x00007ffff7977738 in sf::GlResource::GlResource (this=0x7fffe0156ff0)

And then the same functions on the stack again and again, thousand of times. This occurs in both clients. The server says that for the game:

Game 0 is starting: testing (127.0.0.1) vs. testing2 (127.0.0.1)
Data received from testing (127.0.0.1)
Data received from testing2 (127.0.0.1)
    game n player 1 - Player::setUpGame(true)
    game n player 2 - Player::setUpGame(false)
    game n player 1 - Player::enterTurn(1)
    game n player 1 - Player::resetEnergy([1])
    game n player 1 - Player::changeEnergy([0])
    game n player 1 - Player::changeHealth([0])
    game n player 2 - Player::enterTurn(1)
    game n player 2 - Player::resetEnergy([1])
    game n player 2 - Player::changeEnergy([0])
    game n player 2 - Player::changeHealth([0])
    game n player 1 - Player::enterTurn(2)
    game n player 1 - Player::resetEnergy([1])
    game n player 1 - Player::changeEnergy([0])
    game n player 1 - Player::changeHealth([0])
RobinPetit commented 8 years ago

Comment by RobinPetit Saturday Mar 26, 2016 at 17:22 GMT


I had this too and I haven't anymore so maybe it has been fixed in one of my commits that will arrive in the next push.

RobinPetit commented 8 years ago

Comment by RobinPetit Saturday Mar 26, 2016 at 17:25 GMT


Can you try again with the last version of the branch?

RobinPetit commented 8 years ago

Comment by TheoVerhelst Saturday Mar 26, 2016 at 18:07 GMT


The bog occurs again even with you latest commits.

RobinPetit commented 8 years ago

Comment by RobinPetit Saturday Mar 26, 2016 at 18:11 GMT


All right, I eat and then I'll take a look.

RobinPetit commented 8 years ago

Comment by RobinPetit Sunday Mar 27, 2016 at 00:26 GMT


Does this bug still occur? I can't generate it voluntarily.

Even though I know that there is a SEGFAULT when the game is over.

RobinPetit commented 8 years ago

Comment by TheoVerhelst Sunday Mar 27, 2016 at 01:16 GMT


Yes the bug still occurs. In a client it was really fast (one second after that the board is displayed), and in the other I moved my mouse around and clicked on cards, no segfault happened until I clicked on the button to skip my turn.

RobinPetit commented 8 years ago

Comment by RobinPetit Sunday Mar 27, 2016 at 01:20 GMT


Weird...

RobinPetit commented 8 years ago

Comment by TheoVerhelst Sunday Mar 27, 2016 at 01:47 GMT


It may be related to the fact that, if I understand well your code, you are removing and adding all widgets cards to the GUI at each frame update. Even if that not cause this bug, this has (I think) a noticeable impact on performances.

RobinPetit commented 8 years ago

Comment by RobinPetit Sunday Mar 27, 2016 at 01:53 GMT


Not really all of them but most yes. This is on my todolist, but is after having a working game so... Priorities! :vhs:

RobinPetit commented 8 years ago

Comment by TheoVerhelst Sunday Mar 27, 2016 at 03:01 GMT


I removed unneeded removing, and the performances has been improved a bit, but the bug is still here, like a true warrior, he never falls.

RobinPetit commented 8 years ago

Comment by RobinPetit Sunday Mar 27, 2016 at 16:42 GMT


You still have got the bug? @StanIsAdmin was able to run a game so I'd like to know (since despite all my efforts, I couldn't have this bug).

RobinPetit commented 8 years ago

Comment by TheoVerhelst Sunday Mar 27, 2016 at 17:05 GMT


Yes, nothing changed, I'll try to debug it myself.