Git Product home page Git Product logo

Comments (2)

whales-lee avatar whales-lee commented on July 30, 2024

build libwebsocket disable ipv6 will cause another problem:
Thread 2 "ws_server" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 4304.4305]
0x00007ffff7f78d69 in _orange_socket_callback (wsi=0x7ffff7b27ac0, reason=LWS_CALLBACK_FILTER_NETWORK_CONNECTION, _user=0x7ffff7b54908, in=0xa, len=0) at orange_ws_server.c:173
173 if(user && *user && (*user)->disconnect){
(gdb) backtrace
#0 0x00007ffff7f78d69 in _orange_socket_callback (wsi=0x7ffff7b27ac0, reason=LWS_CALLBACK_FILTER_NETWORK_CONNECTION, _user=0x7ffff7b54908, in=0xa, len=0) at orange_ws_server.c:173
#1 0x00007ffff7f40d30 in rops_handle_POLLIN_listen (pt=0x7ffff7b2f2a0, wsi=0x7ffff7b27ac0, pollfd=0x7ffff7b28040)
at /home/leo/code/openwrt-all/build_dir/target-x86_64_musl/libwebsockets-openssl/libwebsockets-4.2.1/lib/roles/listen/ops-listen.c:128
#2 0x00007ffff7f27d84 in lws_service_fd_tsi (tsi=0, pollfd=0x7ffff7b28040, context=0x7ffff7b2f020)
at /home/leo/code/openwrt-all/build_dir/target-x86_64_musl/libwebsockets-openssl/libwebsockets-4.2.1/lib/core-net/service.c:735
#3 lws_service_fd_tsi (context=context@entry=0x7ffff7b2f020, pollfd=0x7ffff7b28040, tsi=tsi@entry=0)
at /home/leo/code/openwrt-all/build_dir/target-x86_64_musl/libwebsockets-openssl/libwebsockets-4.2.1/lib/core-net/service.c:624
#4 0x00007ffff7f15bb0 in _lws_plat_service_forced_tsi (context=context@entry=0x7ffff7b2f020, tsi=tsi@entry=0)
at /home/leo/code/openwrt-all/build_dir/target-x86_64_musl/libwebsockets-openssl/libwebsockets-4.2.1/lib/plat/unix/unix-service.c:51
#5 0x00007ffff7f15e3a in _lws_plat_service_tsi (tsi=0, timeout_ms=, context=0x7ffff7b2f020)
at /home/leo/code/openwrt-all/build_dir/target-x86_64_musl/libwebsockets-openssl/libwebsockets-4.2.1/lib/plat/unix/unix-service.c:216
#6 _lws_plat_service_tsi (context=0x7ffff7b2f020, timeout_ms=, tsi=0)
at /home/leo/code/openwrt-all/build_dir/target-x86_64_musl/libwebsockets-openssl/libwebsockets-4.2.1/lib/plat/unix/unix-service.c:72
#7 0x00007ffff7f27e76 in lws_service (context=0x7ffff7b2f020, timeout_ms=timeout_ms@entry=60000)
at /home/leo/code/openwrt-all/build_dir/target-x86_64_musl/libwebsockets-openssl/libwebsockets-4.2.1/lib/core-net/service.c:805
#8 0x00007ffff7f788f8 in _websocket_server_thread (ptr=0x7ffff7f65890) at orange_ws_server.c:469
#9 0x00007ffff7fdc658 in ?? ()
#10 0x0000000000000000 in ?? ()

if(user && *user && (*user)->disconnect){
DEBUG("ws_client requested a disconnect!\n");
return -1;
}

code *user point to a invalid memory. cause core dump.

from juci.

whales-lee avatar whales-lee commented on July 30, 2024

patched orange_ws_server.c will fix this.

--- a/src/orange_ws_server.c
+++ b/src/orange_ws_server.c
@@ -166,6 +166,10 @@ static void orange_srv_ws_client_delete(

static int _orange_socket_callback(struct lws *wsi, enum lws_callback_reasons reason, void *_user, void *in, size_t len){
// TODO: keeping user data in protocol is probably not the right place. Fix it.
+

  • if(LWS_CALLBACK_FILTER_NETWORK_CONNECTION == reason)
  •   return 0;
    
  • const struct lws_protocols *proto = lws_get_protocol(wsi);
    struct orange_srv_ws_client **user = (struct orange_srv_ws_client **)_user;

from juci.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.