Comments (5)
Same code crashes in linux
Thread 2 "XControl_Proxy" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7a43700 (LWP 9162)]
send_data (a=0x55555558aee0, from=0x7fffffffe300, data=0x7ffff0000ca0 "/xinfo", data_len=12) at .... /ext/liblo/src/send.c:474
474 sock = from->sockets[0].fd;
(gdb) bt
#0 send_data (a=0x55555558aee0, from=0x7fffffffe300, data=0x7ffff0000ca0 "/xinfo", data_len=12) at ... /ext/liblo/src/send.c:474
#1 0x0000555555569ec5 in lo_send_message_from (a=0x55555558aee0, from=0x7fffffffe300, path=0x7ffff0010b70 "/xinfo", msg=0x7ffff0000b60) at ... /ext/liblo/src/send.c:576
#2 0x00005555555633d9 in lo::Address::send_from (this=0x555555578170 <to>, from=0x7fffffffe300, path=..., m=0x7ffff0000b60) at ... /ext/liblo/lo/lo_cpp.h:258
#3 0x0000555555562c6a in AtoB_generic_handler (path=0x7ffff0010b70 "/xinfo", types=0x7ffff0000bc1 "", argv=0x0, argc=0, m=0x7ffff0000b60, data=0x7fffffffe300) at ... /main.cpp:15
#4 0x000055555556e06c in dispatch_method (s=0x55555558afa0, path=0x7ffff0010b70 "/xinfo", msg=0x7ffff0000b60, sock=-1) at ... /ext/liblo/src/server.c:1942
#5 0x000055555556dcc9 in dispatch_data (s=0x55555558afa0, data=0x7ffff0010b70, size=12, sock=-1) at ... /ext/liblo/src/server.c:1866
#6 0x000055555556d471 in lo_server_recv (s=0x55555558afa0) at ... /ext/liblo/src/server.c:1693
#7 0x000055555556d143 in lo_servers_recv_noblock (s=0x7ffff7a42ea8, recvd=0x7ffff7a42eb4, num_servers=1, timeout=10) at ... /ext/liblo/src/server.c:1577
#8 0x000055555556d1b0 in lo_server_recv_noblock (s=0x55555558afa0, timeout=10) at ... /ext/liblo/src/server.c:1587
#9 0x000055555556f857 in thread_func (data=0x55555558b2a0) at ... /ext/liblo/src/server_thread.c:278
#10 0x00007ffff7fa3609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#11 0x00007ffff7b7f103 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
from liblo.
Hm, so this seems to be a weird C++ "type level" bug, if you want. What's happening is that there are overrides for send_from
that take lo_server
, so what should ideally happen is that the lo_server()
operator of lo::Server
(from which lo::ServerThread
is derived) should be called to get a lo_server
.
But, since on the C level, both lo_server
and lo_server_thread
are typedef'd as void*
, the C++ compiler finds the more direct route of calling lo::ServerThread::lo_server_thread()
. It then dispatches the send_data(lo_server, ..)
, erroneously passing the lo_server_thread
as the lo_server
.
(By the way you should be passing your lo::ServerThread
to send_data
by reference, not by pointer as you have it here.)
From looking at lo_cpp.h
, I tried to handle this by providing a specific override for lo::ServerThread&
. But, even if I fix your code to pass in a lo::ServerThread&
, it's not getting called, instead choosing to always call the variant that takes lo_server
, and I don't know why.
One fix might be to redefine lo_server
and lo_server_thread
to be pointers to empty, distinct structs, instead of to void*
, so that the compiler doesn't see them as the same type. Theoretically that shouldn't break existing code? I'll have to give it a try.
from liblo.
In the meantime, this seems to work:
lo::ServerThread& server = *reinterpret_cast<lo::ServerThread*>(data);
toB.send_from(lo_server_thread_get_server(server), path, m);
from liblo.
I took the leap and redefined the liblo types to fix this problem: 2c1ef1c
Maybe this will warrant a major version bump. Let's see if people report incompatibilities.
from liblo.
Maybe this will warrant a major version bump. Let's see if people report incompatibilities.
Just FYI, unfortunately this does break compatibility with our existing code @radarsat1 :
OpenLightingProject/ola#1949
from liblo.
Related Issues (20)
- cmake doesn't install oscsendfile HOT 1
- Clearing up some confusion (re NSM) HOT 3
- `winsock2.h` not included under MSYS2/MinGW HOT 1
- unexpected behavior when adding multiple different methods with the same address pattern HOT 7
- Sending OSC data through TCP data prepend HOT 4
- Unable to get message's source address with UNIX protocol HOT 2
- Issues using liblo on WSL Ubuntu 18.04 LTS HOT 1
- Server using TCP+SLIP? HOT 11
- lo_url_get_port(): address sanitizer issue HOT 1
- Cmake error on Github Actions HOT 2
- Windows build failing HOT 2
- `lo_blob_new` returns NULL for 0-size blobs HOT 1
- Feature request: improve documentation navigation (and css?)
- Latest release (0.31) isn't reflected in github HOT 2
- Tag a new version? HOT 3
- Linker error with MSVC while building a project which uses liblo HOT 3
- Seeking new liblo maintainer HOT 1
- Likely bug in liblo cpp wrapper HOT 2
- freeing ports HOT 2
- osc.udp://: liblo thing? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liblo.