After adding support for Bluez5 in the latest version of gattlib, the Glib warning message GLib-WARNING **: Invalid file descriptor
was printed every time we were closing a gattlib connection.
Even if the error warning was looking harmless, a warning message should never occurs after a normal operation.
Here are the following steps to fix a Glib warning or error:
Ensure debug support is present in the gattlib based applications:
cd <gattlib_root>
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
Tell Glib library to treat warnings as error:
export G_DEBUG=fatal_warnings
Debug one of the gattlib examples using gdb
:
gdb ./examples/read_write/read_write
Start the program and pass its arguments:
(gdb) run DA:94:40:95:E0:87 read 0x2a38
Starting program: /home/olivier/gattlib/build/examples/read_write/read_write DA:94:40:95:E0:87 read 0x2a38
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[New Thread 0xb7bdab40 (LWP 3594)]
Read UUID completed: 03
(process:3590): GLib-WARNING **: Invalid file descriptor.
Thread 1 "read_w" received signal SIGTRAP, Trace/breakpoint trap.
0xb7cbc749 in g_logv () from /lib/i386-linux-gnu/libglib-2.0.so.0
Inspect the callstack:
(gdb) where
#0 0xb7cbc749 in g_logv () from /lib/i386-linux-gnu/libglib-2.0.so.0
#1 0xb7cbc805 in g_log () from /lib/i386-linux-gnu/libglib-2.0.so.0
#2 0xb7ca7c28 in g_io_channel_error_from_errno () from /lib/i386-linux-gnu/libglib-2.0.so.0
#3 0xb7cfcbee in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#4 0xb7ca84ea in g_io_channel_shutdown () from /lib/i386-linux-gnu/libglib-2.0.so.0
#5 0xb7ca86cd in g_io_channel_unref () from /lib/i386-linux-gnu/libglib-2.0.so.0
#6 0xb7fb988c in io_destroy (io=0xb7200fe8) at /home/olivier/gattlib/bluez5/src/shared/io-glib.c:132
#7 0xb7fa90cb in bt_att_free (att=0xb7202a00) at /home/olivier/gattlib/bluez5/src/shared/att.c:955
#8 0xb7fa94be in bt_att_unref (att=0xb7202a00) at /home/olivier/gattlib/bluez5/src/shared/att.c:1065
#9 0xb7f7f224 in g_attrib_unref (attrib=0xb7200fc0) at /home/olivier/gattlib/bluez5/attrib/gattrib.c:195
#10 0xb7f7932c in gattlib_disconnect (connection=0x804cef8) at /home/olivier/gattlib/src/gattlib_connect.c:359
#11 0x08048c72 in main (argc=4, argv=0xbfffee74) at /home/olivier/gattlib/examples/read_write/read_write.c:93
(gdb)
Fix the issue!
Anonymous
on 28/07/2024 15:19
??????? ??????? ??? ??????
Anonymous
on 08/10/2024 12:59
Our user-friendly platform simplifies the process, offering diverse options for your sleep needs. https://www.cureus.com/users/676889-health-service <a href=https://www.cureus.com/users/676889-health-service>Buy Ambien Online</a> <a href="https://www.cureus.com/users/676889-health-service">Buy Ambien Online</a>
<a href=http://1sistema.ru/blog/uteplenie-sten-iznutri#comment_861430>How Much Nafilin Should I Snort?</a> f4_aad0
Anonymous
on 10/04/2025 01:17
Porn Star: The Good, The Bad, And The Ugly british porn Stars on adultwork
Anonymous
on 30/08/2025 15:56
In today's rapid world, staying informed about the latest updates both locally and globally is more crucial than ever. With a plethora of news outlets struggling for attention, it's important to find a dependable source that provides not just news, but perspectives, and stories that matter to you. This is where <a href=https://www.usatoday.com/>USAtoday.com </a>, a top online news agency in the USA, stands out. Our dedication to delivering the most current news about the USA and the world makes us a key resource for readers who seek to stay ahead of the curve.
Subscribe for Exclusive Content: By subscribing to <a href=https://www.usatoday.com/>USAtoday.com</a>, you gain access to exclusive content, newsletters, and updates that keep you ahead of the news cycle.
<a href=https://www.usatoday.com/>USAtoday.com </a> is not just a news website; it's a dynamic platform that strengthens its readers through timely, accurate, and comprehensive reporting. As we navigate through an ever-changing landscape, our mission remains unwavering: to keep you informed, engaged, and connected. Subscribe to us today and become part of a community that values quality journalism and informed citizenship.
Anonymous
on 09/09/2025 17:22
In today's fast-paced world, staying informed about the latest updates both locally and globally is more vital than ever. With a plethora of news outlets vying for attention, it's important to find a dependable source that provides not just news, but analyses, and stories that matter to you. This is where <a href=https://www.usatoday.com/>USAtoday.com </a>, a premier online news agency in the USA, stands out. Our dedication to delivering the most current news about the USA and the world makes us a go-to resource for readers who seek to stay ahead of the curve.
Subscribe for Exclusive Content: By subscribing to <a href=https://www.usatoday.com/>USAtoday.com</a>, you gain access to exclusive content, newsletters, and updates that keep you ahead of the news cycle.
<a href=https://www.usatoday.com/>USAtoday.com </a> is not just a news website; it's a dynamic platform that empowers its readers through timely, accurate, and comprehensive reporting. As we navigate through an ever-changing landscape, our mission remains unwavering: to keep you informed, engaged, and connected. Subscribe to us today and become part of a community that values quality journalism and informed citizenship.