pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/58249: SIGABRT misc/stellarium by "_res is not supported for multi-threaded programs" in libpthread



The following reply was made to PR pkg/58249; it has been noted by GNATS.

From: Havard Eidnes <he%NetBSD.org@localhost>
To: gnats-bugs%netbsd.org@localhost, oshima-ya%yagoto-urayama.jp@localhost
Cc: pkg-manager%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, pkgsrc-bugs%netbsd.org@localhost
Subject: Re: pkg/58249: SIGABRT misc/stellarium by "_res is not supported
 for multi-threaded programs" in libpthread
Date: Mon, 13 May 2024 16:01:37 +0200 (CEST)

 > _res is not supported for multi-threaded programs.
 > Abort trap (core dumped)
 
 Yep, this is a consequence of using the now-deprecated API to the
 resolver in the c library in a threaded program, ref.
 resolver(3), which among other things says:
 
      The functions res_init(), res_isourserver(), fp_nquery(), p_query(),
      hostalias(), res_query(), res_search(), res_querydomain(), res_mkquery(),
      res_send(), res_update(), res_close() are deprecated and are supplied for
      compatibility with old source code.  They use global configuration and
      state information that is kept in the structure _res rather than that
      referenced through statp.
 
 It's no big surprise that a threaded program cannot work well
 with the use of global state variables possibly tweaked
 independently by different threads.
 
 As for how and where to fix, that's another matter, though this
 is perahps a hint:
 
 > This shows call __res_state by libQt6Network.so ->
 > libpthread.so, and libpthread say "_res is not supported for
 > multi-threaded programs".
 
 So somewhere deep in the bowels of Qt6?  And sure enough:
 
 ./src/network/kernel/qhostinfo_unix.cpp:            res_init();
 
 Looking at the code, it may be as simple as just #if 0'ing out
 the section, ref. the preceding comment which says
 
 #if QT_CONFIG(libresolv)
     // OSes known or thought to reach here: AIX, NetBSD, Solaris,
     // Linux with MUSL (though res_init() does nothing and is unnecessary)
 
 "does nothing and is unnecessary".
 
 What about doing
 
 #if 0
         if ((_res.options & RES_INIT) == 0)
             refresh = true;
 #endif
 
 and
 
 #if 0
         if (refresh) {
             lastStat = st;
             res_init();
         }
 #endif
 
 That's in maybeRefreshResolver(), and it has exceptions for
 Darwin, FreeBSD, OpenBSD and QNX, which all "auto-refresh" or in
 the case of QNX, "res_init() is not thread-safe".  I'm not sure
 if NetBSD "auto-refreshes" when /etc/resolv.conf is modified, but
 looking at the code in libc's resolver library makes me think so,
 ref. res_check() which is called from res_nsend().
 
 
 But, no, that's not the only one:
 
     return domainNameFromRes(&_res);
 
 but possibly that code is never executed on NetBSD (looking at
 the previous section which does res_ninit() and tries to peel out
 the domain name from that state.
 
 Regards,
 
 - Havard
 


Home | Main Index | Thread Index | Old Index