obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.84k stars 704 forks source link

Bug: Crashed if there is another plugin use websocketpp installed #1074

Closed jwang0512 closed 1 year ago

jwang0512 commented 1 year ago

Operating System Info

macOS 12.0

Other OS

No response

OBS Studio Version

28.1.x

OBS Studio Version (Other)

No response

obs-websocket Version

5.1.0

OBS Studio Log URL

https://obsproject.com/logs/dG8pwbHg_z23pbId

OBS Studio Crash Log URL

No response

Expected Behavior

-

Current Behavior

Obs crashed

Steps to Reproduce

  1. install demo plugin : obs-aaa.plugin
  2. start obs
  3. start obs-websocket server

then obs crashed.

here is the full source code of obs-aaa.plugin:

#include <obs-module.h>

#include "plugin-macros.generated.h"
#include "websocketpp/config/asio_client.hpp"
#include "websocketpp/client.hpp"

OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE(PLUGIN_NAME, "en-US")

typedef websocketpp::client<websocketpp::config::asio_client> client;

client ws;
bool obs_module_load(void)
{
        ws.init_asio();
    blog(LOG_INFO, "plugin loaded successfully (version %s)",
         PLUGIN_VERSION);
    return true;
}

void obs_module_unload()
{
    blog(LOG_INFO, "plugin unloaded");
}

Anything else we should know?

No response

tt2468 commented 1 year ago

This is not an obs-websocket bug, but in fact an ASIO bug. Please see https://github.com/obsproject/obs-websocket/commit/9f7beb1c0d9f425e37b200c353c2df0a7fb90737

It is reported at https://github.com/chriskohlhoff/asio/issues/975