joerg-krause writes

Using scctl sometime works when using a UDN:

# scctl -x uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:2:src/netcon-fixed.cpp:707::NetconCli: connect() errno 111 (Connection refused)
:4:scctl_src/scctl.cpp:314::openconn(/tmp/scctl0/sock) failed (ok: server not running)
:4:libupnpp/upnpplib.cxx:156::LibUPnP: Using IP 192.168.1.141 port 49153
:2:libupnpp/control/linnsongcast.cxx:487::Songcast: resetting uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:3:libupnpp/control/service.cxx:289::Service::srvCB: no callback found for sid uuid:db12a1b4-4600-11e7-9a53-f48172b9e787
:2:libupnpp/control/linnsongcast.cxx:497::uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315: not in receiver mode
:4:./libupnpp/workqueue.h:176::setTerminateAndWait:DiscoveredQueue
:4:./libupnpp/workqueue.h:312::WorkQueue:ok:DiscoveredQueue: not ok m_ok 0 m_workers_exited 0 m_worker_threads size 1
:4:./libupnpp/workqueue.h:293::workerExit:DiscoveredQueue
:3:./libupnpp/workqueue.h:192::DiscoveredQueue: tasks 18 nowakes 24 wsleeps 13 csleeps 0
:4:./libupnpp/workqueue.h:216::setTerminateAndWait:DiscoveredQueue done
  1. but sometimes segfaults:

# scctl -x uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:2:src/netcon-fixed.cpp:707::NetconCli: connect() errno 111 (Connection refused)
:4:scctl_src/scctl.cpp:314::openconn(/tmp/scctl0/sock) failed (ok: server not running)
:4:libupnpp/upnpplib.cxx:156::LibUPnP: Using IP 192.168.1.141 port 49153
:2:libupnpp/control/linnsongcast.cxx:487::Songcast: resetting uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:2:libupnpp/control/linnsongcast.cxx:497::uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315: not in receiver mode
Segmentation fault
  1. or:

# scctl -x uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:2:src/netcon-fixed.cpp:707::NetconCli: connect() errno 111 (Connection refused)
:4:scctl_src/scctl.cpp:314::openconn(/tmp/scctl0/sock) failed (ok: server not running)
:4:libupnpp/upnpplib.cxx:156::LibUPnP: Using IP 192.168.1.141 port 49155
:2:libupnpp/control/linnsongcast.cxx:487::Songcast: resetting uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:4:libupnpp/control/linnsongcast.cxx:383::stopReceiver: st.nm HBM10-0478 st.UDN uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:2:libupnpp/control/linnsongcast.cxx:502::uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315 back from receiver mode
:4:./libupnpp/workqueue.h:176::setTerminateAndWait:DiscoveredQueue
Segmentation fault

It never segfaults when using the friendly name:

# scctl -x HBM10-0478
:2:src/netcon-fixed.cpp:707::NetconCli: connect() errno 111 (Connection refused)
:4:scctl_src/scctl.cpp:314::openconn(/tmp/scctl0/sock) failed (ok: server not running)
:4:libupnpp/upnpplib.cxx:156::LibUPnP: Using IP 192.168.1.141 port 49155
:2:libupnpp/control/linnsongcast.cxx:487::Songcast: resetting HBM10-0478
:4:libupnpp/control/linnsongcast.cxx:383::stopReceiver: st.nm HBM10-0478 st.UDN uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:2:libupnpp/control/linnsongcast.cxx:502::HBM10-0478 back from receiver mode
:4:./libupnpp/workqueue.h:176::setTerminateAndWait:DiscoveredQueue
:4:./libupnpp/workqueue.h:312::WorkQueue:ok:DiscoveredQueue: not ok m_ok 0 m_workers_exited 0 m_worker_threads size 1
:4:./libupnpp/workqueue.h:293::workerExit:DiscoveredQueue
:3:./libupnpp/workqueue.h:192::DiscoveredQueue: tasks 53 nowakes 68 wsleeps 36 csleeps 0
:4:./libupnpp/workqueue.h:216::setTerminateAndWait:DiscoveredQueue done

medoc92 writes

Hi,

I’ve tried to reproduce this (using libupnpp 0.15.2, upmpdcli 1.2.14 on x64), and I could not. Do you think that you could obtain a core dump and stack trace ?

Make sure that you are in a writable directory, and then run ulimit -c unlimited. This should hopefully yied a core dump file.

then gdb /usr/bin/scctl core , and thread apply all bt

medoc92 writes

ping ?

joerg-krause writes

I did not forgot. Just busy with another project…

joerg-krause writes

I finally had some time to come back to this issue.

I got the following backtrace:

(gdb) bt
#0  0x706e7074 in ?? ()
#1  0xb6eebd80 in std::function<bool (UPnPClient::UPnPDeviceDesc const&, UPnPClient::UPnPServiceDesc const&) >::operator()(UPnPClient::UPnPDeviceDesc const&, UPnPClient::UPnPServiceDesc const&) const (this=this@entry=0xb6e93ce0, __args#0=..., __args#1=...)
    at /home/jk/buildroot/toolchain/output/host/usr/arm-buildroot-linux-musleabi/include/c++/6.3.0/functional:2127
#2  0xb6eea538 in UPnPClient::UPnPDeviceDirectory::discoExplorer () at libupnpp/control/discovery.cxx:290
#3  0xb6eebc74 in std::_Bind_simple<void* (*(void*))(void*) >::_M_invoke<0u >(std::_Index_tuple<0u >) (this=<optimized out >)
    at /home/jk/buildroot/toolchain/output/host/usr/arm-buildroot-linux-musleabi/include/c++/6.3.0/functional:1391
#4  std::_Bind_simple<void* (*(void*))(void*) >::operator()() (this=<optimized out >)
    at /home/jk/buildroot/toolchain/output/host/usr/arm-buildroot-linux-musleabi/include/c++/6.3.0/functional:1380
#5  std::thread::_State_impl<std::_Bind_simple<void* (*(void*))(void*) >  >::_M_run() (this=<optimized out >)
    at /home/jk/buildroot/toolchain/output/host/usr/arm-buildroot-linux-musleabi/include/c++/6.3.0/thread:196
#6  0xb6b644b4 in execute_native_thread_routine ()
   from /home/jk/buildroot/hbm10/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib/libstdc++.so.6
#7  0xb6fb74a0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

This is the output from the command line:

# gdbserver :2345 scctl -x uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
Process scctl created; pid = 701
Listening on port 2345
Remote debugging from host 192.168.1.157
:2:src/netcon-fixed.cpp:707::NetconCli: connect() errno 111 (Connection refused)
:4:scctl_src/scctl.cpp:313::openconn(/tmp/scctl0/sock) failed (ok: server not running)
:4:libupnpp/upnpplib.cxx:156::LibUPnP: Using IP 192.168.1.103 port 49154
:2:libupnpp/control/linnsongcast.cxx:399::Songcast: resetting uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:3:libupnpp/control/service.cxx:289::Service::srvCB: no callback found for sid uuid:5a60fd78-55ae-11e7-a1bc-b0e598cc2174
:2:libupnpp/control/linnsongcast.cxx:409::uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315: not in receiver mode
:4:./libupnpp/workqueue.h:176::setTerminateAndWait:DiscoveredQueue

medoc92 writes

What libupnpp library code are you using ?

joerg-krause writes

Latest master branch.

medoc92 writes

Does it change something if you change the

return 0;
here: https://github.com/medoc92/upmpdcli/blob/master/scctl_src/scctl.cpp#L273

into

_exit(0);

?

joerg-krause writes

It does not segfault and there is no debug output from the workqueue anymore:

# scctl -x uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:2:src/netcon-fixed.cpp:707::NetconCli: connect() errno 111 (Connection refused)
:4:scctl_src/scctl.cpp:313::openconn(/tmp/scctl0/sock) failed (ok: server not running)
:4:libupnpp/upnpplib.cxx:156::LibUPnP: Using IP 192.168.1.103 port 49159
:2:libupnpp/control/linnsongcast.cxx:399::Songcast: resetting uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315
:3:libupnpp/control/service.cxx:289::Service::srvCB: no callback found for sid uuid:68612056-5653-11e7-b587-f00a2d40b597
:2:libupnpp/control/linnsongcast.cxx:409::uuid:859f8ae8-331a-dc5a-700f-0023b1e3c315: not in receiver mode
#