Skip to content
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

firefox visit openwrt juci got a running cycle. F12 network print these messages: #92

Open
whales-lee opened this issue Oct 31, 2021 · 2 comments

Comments

@whales-lee
Copy link

RPC init 01-juci.js:1:1794421
connecting to rpc server at (ws://192.168.80.134/websocket/) 01-juci.js:1:1763229
Firefox can’t establish a connection to the server at ws://192.168.80.134/websocket/. 01-juci.js:1:1763059
connection failed! 01-juci.js:1:1763437
onerror http://192.168.80.134/js/01-juci.js:1
could not connect to rpc interface 01-juci.js:1:1794765
UCI Init 01-juci.js:1:1794842
No uci rpc object present! 01-juci.js:1:1788418
connection closed! 01-juci.js:1:1763513
UCI failed to initialize! 01-juci.js:1:1794940
init http://192.168.80.134/js/01-juci.js:1
j http://192.168.80.134/js/01-juci.js:1
fireWith http://192.168.80.134/js/01-juci.js:1
f[0] http://192.168.80.134/js/01-juci.js:1
init http://192.168.80.134/js/01-juci.js:1
JUCI Init 01-juci.js:1:1795008
init: config 01-juci.js:1:1802569

root@OpenWrt:/etc/init.d# ubus list
dhcp
dnsmasq
file
hotplug.dhcp
hotplug.iface
hotplug.neigh
hotplug.net
hotplug.ntp
hotplug.tftp
iwinfo
log
luci-rpc
network
network.device
network.interface
network.interface.lan
network.interface.loopback
network.wireless
rc
rpc-sys
service
session
system
uci
root@OpenWrt:/etc/init.d# ps | grep ubus
1974 ubus 924 S /sbin/ubusd
2361 root 1316 S /sbin/rpcd -s /var/run/ubus/ubus.sock -t 30
4341 root 1104 R grep ubus
root@OpenWrt:/etc/init.d#
root@OpenWrt:/etc/init.d#
root@OpenWrt:/etc/init.d# ps | grep ubus
1974 ubus 924 S /sbin/ubusd
2361 root 1316 S /sbin/rpcd -s /var/run/ubus/ubus.sock -t 30
4343 root 1104 R grep ubus
root@OpenWrt:/etc/init.d# ps | grep rpcd
2361 root 1316 S /sbin/rpcd -s /var/run/ubus/ubus.sock -t 30
3481 root 11224 S /usr/bin/orangerpcd -p /usr/lib/orange/api/
4345 root 1104 R grep rpcd
root@OpenWrt:/etc/init.d# ps | grep lighttpd
3130 http 5200 S /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
4347 root 1104 R grep lighttpd

@whales-lee
Copy link
Author

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.

@whales-lee
Copy link
Author

whales-lee commented Nov 17, 2021

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;

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

1 participant