-
-
Notifications
You must be signed in to change notification settings - Fork 711
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
Possible crash when a client disconnects #21
Comments
I was able to reproduce it by refreshing a page rapidly. Multiple refreshes slowly works fine, however, refreshing quickly enough causes OBS to crash. |
21:38:02.451: [obs-websockets] new client connected from �:40388 |
@coolacid What you're telling is that several successive connections and disconnections to obs-websocket make OBS crash ? |
@coolacid Regarding the log excerpt in your last comment, this is a problem I already noticed. Can't tell right now if it's linked with this issue. |
Hey @Palakis I'm not sure if it's related either. Yes. Successive connections/disconnects will crash OBS. At first I could only trigger it by refreshing multiple screens, I was finally able to consistently cause the issue only while refreshing semi-slowly. Judging from the new client issue (and not knowing the underlying libs) is it possible a race condition exists between when the client connects, disconnects and the log line is logged? Ie:
Note, I created a simple python app to connect to the OBS server and could not get a crash to happen. No matter how often I ran the script. This lead credence to the above since the python libraries ensure the connection fully happens before moving on. I'm trying to create something to consistently trigger the issue. |
At this point, I can confirm that the ÿÿÿÿ:0 appears to be related. It's also related to the browser closing the connection after sending the headers. While I can't get a script to trigger it, I tested again in the browser inspecting the WS connections. I can see the headers from the browser, however I triggered a refresh before the browser got the response, yielding the incorrect IP as above, and the crash on OBS. |
I've had this string pointer issue since the beginning of the project. I also had it in the Websocket message handler code but managed to solve it. |
I just got two back to back crashes with the following trace: Thread 464 (Crashed) Is it possible I'm killing the connection just in time where the plugin is still building the server connection side, but hasn't ran the kill connection code? Maybe checking the socket is valid before sending data? Sorry, doing the best I can since I'm not a strong C coder ;) |
I can't reproduce the issue (tried with 64bit OBS Studio), but I anyway fixed the IP address issue in the log messages (27ec094). |
Confirmed the logging issue is gone, however I can still cause OBS to crash. :( JS code to crash
Refreshing at fairly fast random refreshes causes the crash. |
Where does the JS module you're using comes from ? |
Ha ! Now I can reproduce it ! |
I don't think it's reconnections. I can refresh slowly and never hit the crash. However, if I catch the refresh just right the websocket never fully connects ('finished' status instead of 'switching protocols') which causes the crash. |
Agree, I can see this with the Visual Studio debugger attached. The pointer exception happens in a function call used by a function named |
Not sure if it cares about whether its the same client reconnecting or multiple clients connecting in rapid succession. I can set up some tests this evening too. |
Made a dozen connections within a second. No crash. Crash log. Here's a simple test for this though. Download the page and run locally if you're on Firefox, otherwise I think Chrome and IE might allow insecure socket connections. EDIT: 25 Connections, 500ms between each, disconnect 250ms after connect. |
I also use obs-websocket-js and I get crashes more or less often. Here is an example crash-log |
Qt 5.8 will be available soon. Will test obs-websocket with it as soon as it's out. |
I notice that on the first ever connection to the Websocket server after launch, the framerate drops significantly. |
https://github.com/Palakis/obs-websocket/blob/master/WSServer.cpp#L85-L86 The issue could simply be you're using a QList without using a QMutex. You're reading/writing from separate threads. Locking/unlocking on adding and removing a client is a must. |
I'm gonna try messing with that later. Makes a ton of sense now that you say it, Theoretical. |
I found two different crash causes :
Plus the concurrent access issue mentioned by @Theoretical (fixed in 748b6f6). I can't trigger a crash caused by this issue, even though theory says accesses to the clients list has to be protected with a mutex. When testing, I use haganbmj's tool with the following settings :
One can reproduce the first issue mentioned above with these settings. |
https://github.com/Palakis/obs-websocket/blob/master/WSRequestHandler.cpp#L109 You're also deleting the object twice. Should be just lowered to once for that. |
@Theoretical "You're [...] deleting the object twice" |
https://github.com/Palakis/obs-websocket/blob/master/WSRequestHandler.cpp#L109 Those are the same client objects being deleted at the same time, right? |
@Theoretical nope. Those are two different objects. |
I finally managed to fix this issue by rewriting the way the plugin handles session-specific variables (e.g. : client authenticated or not) because I think I was misusing Qt's object model and event loop, which was the cause of several crash types I encountered while debugging. The Thanks to all the people who participated in this thread and in the debugging process. I spent a lot of time working on this issue and I'm glad it's fixed now. |
|
We've been using the websocket as a remote tool to change scenes and get information on current status. This is installed using the zip file.
We coded a custom web application to access the websocket, following the API documentations using the node API library.
The remote control web-app stays connected for hours at a time, and we've had it crash [consistently] after refreshing.
Crash dump:
The text was updated successfully, but these errors were encountered: