Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12195 closed bug (fixed)

[Network] silently quits upon selecting DNS settings

Reported by: diver Owned by: pulkomandy
Priority: normal Milestone: R1/beta1
Component: Preferences/Network Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by diver)

hrev49371.

Clicking DNS settings in Network preflet quits with _res is not supported for multi-threaded programs. message.

Change History (6)

comment:1 by jua, 9 years ago

The DNS network settings use the global __res API which, according to [0], has been out of favour for a long time. In hrev49371 I switched our netresolv to use the thread-safe version of the res functions, which are also used internally by getaddrinfo() and others (for further explanation see the commit message). It was necessary because the thread-unsafe version broke name resolution in the Services Kit (as soon as more than one request happened at the same time).

However, the thread-safe implementation doesn't support the old __res_state() API at all anymore, hence this bug. On the NetBSD problem report in [0] it is recommended to use a local _res_state via res_ninit() and res_nclose() instead. I'm not familiar with these APIs - maybe Axel can comment if that would be feasible?

Other options would be extending netresolv ourselves to allow using this (basically, providing a mix of NetBSD's thread-safe and thread-unsafe functions, not a good choice I think), or switching to a different implementation altogether.

[0] http://gnats.netbsd.org/46661 (thanks to Diver for providing the link)

Last edited 9 years ago by jua (previous) (diff)

comment:2 by diver, 9 years ago

Description: modified (diff)

comment:3 by axeld, 9 years ago

Actually, Adrien wrote that code; I have no idea. However, following the advise in the link you provided sounds like it may work:

Instead start using the thread-safe versions of the functions (it is as simple as changing res_send() to res_nsend() for example and managing your own _res_state with res_ninit()/res_nclose()). They've been there for almost a decade now, and there is no excuse for dicking with _res directly anymore!

comment:4 by pulkomandy, 9 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev49403.

comment:5 by diver, 9 years ago

My TraceRoute quits with the same error message.

comment:6 by pulkomandy, 9 years ago

It probably uses the same API, and should use something else instead.

Note: See TracTickets for help on using tickets.