Update: we have detected the origin of the bug; we launch an OpenVPN (interface tun type) in the machine where we run the software; when the interface is up the enumeration of interfaces halts with a SEGV, so C and Python both code breaks.....
Thanks for your support and eventual correction/workaround
---------
Hi. We are working with a T4 device on Linux.
Ubuntu 16.04.4 LTS
Linux 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
and we are not able to manage it all via C or Python. After debugging symbols we have reach to a SEGV on libLabJackM.so
Thread 1 "eNames" received signal SIG40, Real-time event 40.
0x00007fff9b377627 in __GI_epoll_pwait (epfd=18, events=0x7fffffffd2c0, maxevents=100,
timeout=-1, set=0x7fff9bfc98d0) at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
42 ../sysdeps/unix/sysv/linux/epoll_pwait.c: No existe el archivo o el directorio.
(gdb) where
#0 0x00007fff9b377627 in __GI_epoll_pwait (epfd=18, events=0x7fffffffd2c0,
maxevents=100, timeout=-1, set=0x7fff9bfc98d0)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007fff9b8c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007fff9b8ad83a in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007fff9b8adf8e in grpc_completion_queue_pluck ()
from /usr/local/lib/libLabJackM.so
#4 0x00007fff9b8856f8 in grpc::CoreCodegen::grpc_completion_queue_pluck(grpc_completion_queue*, void*, gpr_timespec, void*) () from /usr/local/lib/libLabJackM.so
#5 0x00007fff9b880753 in grpc::Status grpc::BlockingUnaryCall<labjack::ProcessDescription, labjack::ProcessDescriptions>(grpc::ChannelInterface*, grpc::RpcMethod const&, grpc::ClientContext*, labjack::ProcessDescription const&, labjack::ProcessDescriptions*) ()
from /usr/local/lib/libLabJackM.so
#6 0x00007fff9b8779ad in labjack::MetaService::Stub::Heartbeat(grpc::ClientContext*, labjack::ProcessDescription const&, labjack::ProcessDescriptions*) ()
from /usr/local/lib/libLabJackM.so
#7 0x00007fff9b809c45 in LJMetaAgent::TryHeartbeat(boost::interprocess::scoped_lock<boost::timed_mutex> const&) () from /usr/local/lib/libLabJackM.so
#8 0x00007fff9b80a8e7 in LJMetaAgent::TryForAnchor(boost::interprocess::scoped_lock<boost::timed_mutex> const&) () from /usr/local/lib/libLabJackM.so
#9 0x00007fff9b80ac5a in LJMetaAgent::Init() () from /usr/local/lib/libLabJackM.so
#10 0x00007fff9b7e4e58 in DeviceFactory::MetaAgentInit() ()
from /usr/local/lib/libLabJackM.so
#11 0x00007fff9b7ea9e1 in DeviceFactory::OpenAllMatchingConnections(ConnectionRequest const&, ConnectionTypes const&, RequestResults*) () from /usr/local/lib/libLabJackM.so
#12 0x00007fff9b7eabd8 in DeviceFactory::OpenRequestAfterLocks(ConnectionRequest const&, ConnectionTypes const&, RequestResults*) () from /usr/local/lib/libLabJackM.so
#13 0x00007fff9b7ead08 in DeviceFactory::OpenRequest(ConnectionRequest const&, RequestResults*) () from /usr/local/lib/libLabJackM.so
#14 0x00007fff9b7eae7d in DeviceFactory::OpenDevice(OpenAdapter const*) ()
from /usr/local/lib/libLabJackM.so
#15 0x00007fff9b7c3749 in LJM_Open () from /usr/local/lib/libLabJackM.so
#16 0x000000000040298f in main () at eNames.c:32
Any clue? Thanks a lot for your help.
LJM uses gRPC, which internally uses SIG40 to wake up threads. By default, gdb breaks upon the process receiving a signal. To circumvent this, you can use the gdb command handle SIG40 noprint nostop (similarly as is mentioned in gRPC issue SIG36 while debugging with gdb #7906).
For another workaround, try setting the LJM library configuration LJM_RPC_ENABLE to 0 (false). Do this before calling any Open or ListAll calls. This can be done in the startup configs or by by writing using WriteLibraryConfigS.
For example, in C:
int error = LJM_WriteLibraryConfigS("LJM_RPC_ENABLE", 0);
if (error != LJME_NOERROR) {
// handle error
printf("LJM_RPC_ENABLE fail\n");
}
or, with LJM_Utilities.h:
SetConfigValue("LJM_RPC_ENABLE", 0);
Does eNames crash when not run with gdb?
For future reference, I've added a troubleshooting page to address this:
https://labjack.com/support/510-gdb-breaks-signal-sig40-real-time-event-40
Yes, eNames breaks as well when not run within gdb. As noted we've detected that this SEGV arises when a OpenVPN is launched in the machine.
We've tried the LJM_RPC_ENABLE workaround but we've got the same results.
Thanks for your help.
Since the stack trace you've shared in your first post is for SIG40 instead of SIGSEGV, can you provide a stack trace for SIGSEGV?
Please provide the stack trace from runnig gdb as follows:
$ gdb ./eNames
(gdb) handle SIG40 noprint nostop
(gdb) r
Wait for the program to crash, then run the gdb command bt.
Or you could provide the gdb output of thread apply all bt instead.
OK, here we go with both outputs (as you can see both shows that is related to te numeratio of network interfaces, and this only happens when the OpenVPN tun interface is up)
Output from bt
(gdb) bt
#0 0x00007ffff7866be4 in NixDeviceFactory::GetNetworkInterfaces() ()
from /usr/local/lib/libLabJackM.so
#1 0x00007ffff77e7071 in DeviceFactory::OpenAllNetwork(LJM_ConnectionType, ConnectionRequest const&, RequestResults*) () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff77e7417 in DeviceFactory::SingleConnectionTypeRequest(LJM_ConnectionType, ConnectionRequest const&, RequestResults*) ()
from /usr/local/lib/libLabJackM.so
#3 0x00007ffff77ecf58 in boost::asio::detail::completion_handler<boost::_bi::bind_t<void, boost::_mfi::mf3<void, DeviceFactory, LJM_ConnectionType, ConnectionRequest const&, RequestResults*>, boost::_bi::list4<boost::_bi::value<DeviceFactory*>, boost::_bi::value<LJM_ConnectionType>, boost::_bi::value<ConnectionRequest>, boost::_bi::value<RequestResults*> > > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) () from /usr/local/lib/libLabJackM.so
#4 0x00007ffff77ee189 in boost::asio::detail::task_io_service::run(boost::system::error_code&) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff77e960a in DeviceFactory::OpenAllMatchingConnections(ConnectionRequest const&, ConnectionTypes const&, RequestResults*) ()
from /usr/local/lib/libLabJackM.so
#6 0x00007ffff77e99cc in DeviceFactory::OpenRequestAfterLocks(ConnectionRequest const&, ConnectionTypes const&, RequestResults*) ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff77e9b98 in DeviceFactory::OpenRequest(ConnectionRequest const&, RequestResults*) () from /usr/local/lib/libLabJackM.so
#8 0x00007ffff77e9dcd in DeviceFactory::OpenDevice(OpenAdapter const*) ()
from /usr/local/lib/libLabJackM.so
#9 0x00007ffff77be0d9 in LJM_Open () from /usr/local/lib/libLabJackM.so
#10 0x000000000040298f in main () at eNames.c:32
And output from thread apply all bt
Thread 18 (Thread 0x7fffe67fc700 (LWP 325)):
#0 [email protected]@GLIBC_2.3.2 ()
at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1 0x00007ffff77ee0c9 in boost::asio::detail::task_io_service::run(boost::system::error_code&) () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff77ef766 in boost::asio::io_service::run() ()
from /usr/local/lib/libLabJackM.so
#3 0x00007ffff79bcd64 in ?? () from /usr/local/lib/libLabJackM.so
#4 0x00007ffff6e3a6ba in start_thread (arg=0x7fffe67fc700)
at pthread_create.c:333
#5 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 17 (Thread 0x7fffe6ffd700 (LWP 324)):
#0 [email protected]@GLIBC_2.3.2 ()
at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1 0x00007ffff6b6491c in std::condition_variable::wait(std::unique_lock<std::mutex>&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2 0x00007ffff7888109 in grpc::Server::Wait() ()
from /usr/local/lib/libLabJackM.so
#3 0x00007ffff780a90d in LJMetaAgent::MetaServerRun() ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff79bcd64 in ?? () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff6e3a6ba in start_thread (arg=0x7fffe6ffd700)
at pthread_create.c:333
#6 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 16 (Thread 0x7fffe77fe700 (LWP 323)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=36, events=0x7fffe77fd600,
maxevents=100, timeout=10000, set=0x7fffe77fe650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffe77fe700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 15 (Thread 0x7fffe7fff700 (LWP 322)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=34, events=0x7fffe7ffe600,
maxevents=100, timeout=10000, set=0x7fffe7fff650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffe7fff700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 14 (Thread 0x7fffecff9700 (LWP 321)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=32, events=0x7fffecff8600,
maxevents=100, timeout=10000, set=0x7fffecff9650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffecff9700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 13 (Thread 0x7fffed7fa700 (LWP 320)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=30, events=0x7fffed7f9600,
maxevents=100, timeout=10000, set=0x7fffed7fa650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffed7fa700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 10 (Thread 0x7fffedffb700 (LWP 317)):
#0 [email protected]@GLIBC_2.3.2 ()
at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1 0x00007ffff6b6491c in std::condition_variable::wait(std::unique_lock<std::mutex>&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2 0x00007ffff7888109 in grpc::Server::Wait() ()
from /usr/local/lib/libLabJackM.so
#3 0x00007ffff7810225 in LJMumbleServer::MumbleServerRun() ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff79bcd64 in ?? () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff6e3a6ba in start_thread (arg=0x7fffedffb700)
at pthread_create.c:333
#6 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 9 (Thread 0x7fffee7fc700 (LWP 316)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=22, events=0x7fffee7fb600,
maxevents=100, timeout=10000, set=0x7fffee7fc650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*
, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffee7fc700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 8 (Thread 0x7fffeeffd700 (LWP 315)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=20, events=0x7fffeeffc600,
maxevents=100, timeout=10000, set=0x7fffeeffd650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffeeffd700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 7 (Thread 0x7fffef7fe700 (LWP 314)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=18, events=0x7fffef7fd600,
maxevents=100, timeout=10000, set=0x7fffef7fe650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffef7fe700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 6 (Thread 0x7fffeffff700 (LWP 313)):
#0 0x00007ffff736f627 in __GI_epoll_pwait (epfd=16, events=0x7fffefffe600,
maxevents=100, timeout=10000, set=0x7fffeffff650)
at ../sysdeps/unix/sysv/linux/epoll_pwait.c:42
#1 0x00007ffff78c99f5 in ?? () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78add4e in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78adf6e in grpc_completion_queue_next ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff7885618 in grpc::CompletionQueue::AsyncNextInternal(void**, bool*, gpr_timespec) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff788b96d in grpc::Server::SyncRequestThreadManager::PollForWork(void**, bool*) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff7891c85 in grpc::ThreadManager::MainWorkLoop() ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff7891dac in grpc::ThreadManager::WorkerThread::Run() ()
from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6b69c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#9 0x00007ffff6e3a6ba in start_thread (arg=0x7fffeffff700)
at pthread_create.c:333
#10 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 4 (Thread 0x7ffff5387700 (LWP 311)):
#0 [email protected]@GLIBC_2.3.2 ()
at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:225
#1 0x00007ffff7893aca in gpr_cv_wait () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff78a3e6b in ?? () from /usr/local/lib/libLabJackM.so
#3 0x00007ffff78bf367 in ?? () from /usr/local/lib/libLabJackM.so
#4 0x00007ffff6e3a6ba in start_thread (arg=0x7ffff5387700)
at pthread_create.c:333
#5 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 3 (Thread 0x7ffff5b88700 (LWP 310)):
#0 _int_free (av=0x7ffff0000020, p=0x7ffff01c2f20, have_lock=0)
at malloc.c:3841
#1 0x00007ffff72ec53c in __GI___libc_free (mem=<optimized out>)
at malloc.c:2968
#2 0x00007ffff7823aef in ModbusRegister::ExpandName(std::string const&) ()
from /usr/local/lib/libLabJackM.so
#3 0x00007ffff7823e89 in ModbusRegister::GetExpandedName() const ()
from /usr/local/lib/libLabJackM.so
#4 0x00007ffff781ae8c in ModbusInterpreter::AddModbusRegister(Json::Value, boost::interprocess::scoped_lock<boost::mutex>&) ()
from /usr/local/lib/libLabJackM.so
#5 0x00007ffff781b29b in ModbusInterpreter::AddRegisters(Json::Value, boost::interprocess::scoped_lock<boost::mutex>&) () from /usr/local/lib/libLabJackM.so
#6 0x00007ffff781b6da in ModbusInterpreter::LoadConstants(char const*, Interpreter::LoadOption, boost::interprocess::scoped_lock<boost::mutex>*) ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff79bcd64 in ?? () from /usr/local/lib/libLabJackM.so
#8 0x00007ffff6e3a6ba in start_thread (arg=0x7ffff5b88700)
at pthread_create.c:333
#9 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 2 (Thread 0x7ffff6389700 (LWP 309)):
#0 0x00007ffff736374d in poll () at ../sysdeps/unix/syscall-template.S:84
#1 0x00007ffff705f64c in ?? () from /lib/x86_64-linux-gnu/libusb-1.0.so.0
#2 0x00007ffff6e3a6ba in start_thread (arg=0x7ffff6389700)
at pthread_create.c:333
#3 0x00007ffff736f41d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
Thread 1 (Thread 0x7ffff7fc9980 (LWP 305)):
#0 0x00007ffff7866be4 in NixDeviceFactory::GetNetworkInterfaces() ()
from /usr/local/lib/libLabJackM.so
#1 0x00007ffff77e7071 in DeviceFactory::OpenAllNetwork(LJM_ConnectionType, ConnectionRequest const&, RequestResults*) () from /usr/local/lib/libLabJackM.so
#2 0x00007ffff77e7417 in DeviceFactory::SingleConnectionTypeRequest(LJM_ConnectionType, ConnectionRequest const&, RequestResults*) ()
from /usr/local/lib/libLabJackM.so
#3 0x00007ffff77ecf58 in boost::asio::detail::completion_handler<boost::_bi::bind_t<void, boost::_mfi::mf3<void, DeviceFactory, LJM_ConnectionType, ConnectionRequest const&, RequestResults*>, boost::_bi::list4<boost::_bi::value<DeviceFactory*>, boost::_bi::value<LJM_ConnectionType>, boost::_bi::value<ConnectionRequest>, boost::_bi::value<RequestResults*> > > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) () from /usr/local/lib/libLabJackM.so
#4 0x00007ffff77ee189 in boost::asio::detail::task_io_service::run(boost::system::error_code&) () from /usr/local/lib/libLabJackM.so
#5 0x00007ffff77e960a in DeviceFactory::OpenAllMatchingConnections(ConnectionRequest const&, ConnectionTypes const&, RequestResults*) ()
from /usr/local/lib/libLabJackM.so
#6 0x00007ffff77e99cc in DeviceFactory::OpenRequestAfterLocks(ConnectionRequest const&, ConnectionTypes const&, RequestResults*) ()
from /usr/local/lib/libLabJackM.so
#7 0x00007ffff77e9b98 in DeviceFactory::OpenRequest(ConnectionRequest const&, RequestResults*) () from /usr/local/lib/libLabJackM.so
#8 0x00007ffff77e9dcd in DeviceFactory::OpenDevice(OpenAdapter const*) ()
from /usr/local/lib/libLabJackM.so
#9 0x00007ffff77be0d9 in LJM_Open () from /usr/local/lib/libLabJackM.so
#10 0x000000000040298f in main () at eNames.c:32
As a complement please find attached the output from both commands below.
1. What is the output of ifconfig?
2. What does the gdb log look like if you replace eNames.c with the attached eNames.c, rebuild it with make.sh, and run with gdb ./eNames? Please run bt if you get a seg fault.
1. ifconfig output
[email protected]-PRO-ZeusBridge001 [13:11:47]> ifconfig
enp1s0 Link encap:Ethernet HWaddr 00:90:27:ed:6c:e6
inet addr:192.168.98.243 Bcast:192.168.98.255 Mask:255.255.255.0
inet6 addr: fe80::290:27ff:feed:6ce6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1410486 errors:0 dropped:0 overruns:0 frame:0
TX packets:645488 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:961828810 (961.8 MB) TX bytes:77735307 (77.7 MB)
Interrupt:16 Memory:dfe00000-dfe20000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:599 errors:0 dropped:0 overruns:0 frame:0
TX packets:599 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:41918 (41.9 KB) TX bytes:41918 (41.9 KB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.110.1 P-t-P:10.8.0.1 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:1307 errors:0 dropped:0 overruns:0 frame:0
TX packets:1000 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:433763 (433.7 KB) TX bytes:110208 (110.2 KB)
2. New eNames. SEGV arises. Here goes the bt output
[email protected]-PRO-ZeusBridge001 [13:11:05]> gdb eNames
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from eNames...done.
(gdb) t
No thread selected
(gdb) r
Starting program: /root/FEC/labjack_ljm_software_2017_12_21_x86_64/labjack_ljm_examples/examples/eNames
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00000000004029d7 in GetNetworkInterfaces () at eNames.c:34
34 int family = ifIter->ifa_addr->sa_family;
(gdb) bt
#0 0x00000000004029d7 in GetNetworkInterfaces () at eNames.c:34
#1 0x0000000000402af5 in main () at eNames.c:86
I may have found the problem. (The ifa_addr field is allowed to be NULL.) Please retry with the attached eNames.c. It should output "May 8th".
Bingo! It works.... So, what shall we do? I guess this is something that has to be corrected in the library so we can use it in our C and Python implementation, hasn't be? Or there's something we can do in our code?
Thanks a lot for your effort.
[email protected]-PRO-ZeusBridge001 [17:19:35]> ./eNames
May 8th
ifIter->ifa_name: lo
ifIter->ifa_name: enp1s0
ifIter->ifa_name: tun0
end GetNetworkInterfaces
Excellent! Yes, you are correct that it is a change to LJM code that will need to be released. I anticipate that will happen this week. I will post a message in this thread when the fix is released.
To mitigate the situation until then, you can use a USB connection to your device. To prevent LJM from querying GetNetworkInterfaces, you'll need to pass USB as the ConnectionType parameter. (The string "USB" works for LJM_OpenS, the constant LJM_ctUSB for LJM_Open.)
Thank you for patiently sending backtraces.
Thanks to you for your excellent support. We will wait for the new LJM release.
LJM 1.1803 fixes the issue. It is currently available for Windows, macOS, and Linux 32-bit and 64-bit:
https://labjack.com/support/software/installers/ljm
Thank you for your patience.