8000 Server segfault after client leaves (opengl3) · Issue #40 · sammyfreg/netImgui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Server segfault after client leaves (opengl3) #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hinxx opened this issue Oct 27, 2022 · 5 comments
Closed

Server segfault after client leaves (opengl3) #40

hinxx opened this issue Oct 27, 2022 · 5 comments

Comments

@hinxx
Copy link
hinxx commented Oct 27, 2022

After compiling and running the server and client (#39 ) under Linux the server dies if the client leaves.
Code was compiled on Linux Mint 20 using system glfw and opengl3 libraries.

Here is the backtrace from gdb:

Thread 4 "netimgui_server" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff2819700 (LWP 373138)]
0x00007ffff74e5b69 in ?? () from /lib/x86_64-linux-gnu/libGLdispatch.so.0
(gdb) bt
#0  0x00007ffff74e5b69 in ?? () from /lib/x86_64-linux-gnu/libGLdispatch.so.0
#1  0x00005555556991b9 in NetImguiServer::App::HAL_DestroyRenderTarget (pOutRT=@0x555555c30bb8: 0x0, pOutTexture=@0x555555c30bc0: 0x4) at GlfwGL3/NetImguiServer_HAL_GL3.cpp:92
#2  0x00005555556747b2 in NetImguiServer::RemoteClient::Client::Reset (this=0x555555c30bb8) at NetImguiServer_RemoteClient.cpp:137
#3  0x0000555555670dd9 in NetImguiServer::Network::Communications_ClientExchangeLoop (pClientSocket=0x7fffec0014b0, pClient=0x555555c30bb8) at NetImguiServer_Network.cpp:198
#4  0x0000555555673d56 in std::__invoke_impl<void, void (*)(NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*), NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*> (
    __f=@0x7fffec0014e8: 0x555555670c96 <NetImguiServer::Network::Communications_ClientExchangeLoop(NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*)>)
    at /usr/include/c++/9/bits/invoke.h:60
#5  0x0000555555673c03 in std::__invoke<void (*)(NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*), NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*> (
    __fn=@0x7fffec0014e8: 0x555555670c96 <NetImguiServer::Network::Communications_ClientExchangeLoop(NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*)>)
    at /usr/include/c++/9/bits/invoke.h:95
#6  0x0000555555673a91 in std::thread::_Invoker<std::tuple<void (*)(NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*), NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*> >::_M_invoke<0ul, 1ul, 2ul> (this=0x7fffec0014d8) at /usr/include/c++/9/thread:244
#7  0x00005555556739e7 in std::thread::_Invoker<std::tuple<void (*)(NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*), NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*> >::operator() (this=0x7fffec0014d8) at /usr/include/c++/9/thread:251
#8  0x0000555555673976 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*), NetImgui::Internal::Network::SocketInfo*, NetImguiServer::RemoteClient::Client*> > >::_M_run (this=0x7fffec0014d0) at /usr/include/c++/9/thread:195
#9  0x00007ffff7e2fde4 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00007ffff7bd4609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007ffff7af7133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

(gdb) f 1
#1  0x00005555556991b9 in NetImguiServer::App::HAL_DestroyRenderTarget (pOutRT=@0x555555c30bb8: 0x0, pOutTexture=@0x555555c30bc0: 0x4) at GlfwGL3/NetImguiServer_HAL_GL3.cpp:92

92			glDeleteFramebuffers(1, &pRT);
(gdb) p pRT

$1 = 1
(gdb) p *pRT
Cannot access memory at address 0x1
@sammyfreg
Copy link
Owner
sammyfreg commented Oct 27, 2022 via email

@hinxx
Copy link
Author
hinxx commented Oct 28, 2022

I've been looking into the issue a bit more myself. Here is some info from the libGLdispatch.so folks: https://gitlab.freedesktop.org/glvnd/libglvnd/-/issues/237.

I tried to comment out the

and then just close the server app while the client is connected and no segfault appeared.
The Client::Reset() was still invoked at that point, through Client::Client(), but this time from the main thread.

@hinxx
Copy link
Author
hinxx commented Oct 28, 2022

After a dirty hack found in the hinxx.txt I get no more segfaults.

The UpdateRemoteContent() calls the Client::Reset() after the comm thread sets the (newly introduced) flag client flag mDestroy instead of it calling pClient->Reset();.

@sammyfreg
Copy link
Owner
sammyfreg commented Oct 28, 2022 via email

@sammyfreg
Copy link
Owner

I have fixes the issue in c707101, using something similar to what you already tried. I'm happy to see that the NetImguiServer runs fine on linux!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0