Philip Withnall
40be86bb0e
gio: Port GThreadedResolver to use res_nquery() to fix thread-safety
...
res_query() uses global state in the form of the struct __res_state
which contains the contents of resolv.conf (and other things). On Linux,
this state seems to be thread-local, so there is no problem. On OS X,
however, it is not, and hence multiple res_query() calls from parallel
threads will compete and return bogus results.
The fix for this is to use res_nquery(), introduced in BIND 8.2, which
takes an explicit state argument. This allows us to manually store the
state thread-locally. If res_nquery() isn’t available, we fall back to
res_query(). It should be available on OS X though. As a data point,
it’s available on Fedora 27.
There’s a slight complication in the fact that OS X requires the state
to be freed using res_ndestroy() rather than res_nclose(). Linux uses
res_nclose().
(See, for example, the NetBSD man page:
https://www.unix.com/man-page/netbsd/3/res_ninit/ . The Linux one is
incomplete and not so useful:
http://man7.org/linux/man-pages/man3/resolver.3.html .)
The new code will call res_ninit() once per res_nquery() task. This is
not optimal, but no worse than before — since res_query() was being
called in a worker thread, on Linux, it would implicitly initialise the
thread-local struct __res_state when it was called. We’ve essentially
just made that explicit. In practical terms, this means a
stat("/etc/resolv.conf") call per res_nquery() task.
In future, we could improve this by using an explicit thread pool with
some manually-created worker threads, each of which initialises a struct
__res_state on spawning, and only updates it on receiving
the #GResolver::reload signal.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://bugzilla.gnome.org/show_bug.cgi?id=792050
2018-02-02 18:05:27 +01:00
..
2018-01-05 13:01:03 +00:00
2017-05-29 19:53:34 +02:00
2018-01-31 22:12:51 +00:00
2017-05-29 19:53:34 +02:00
2017-11-28 14:25:34 +00:00
2017-11-28 13:55:34 +00:00
2018-02-02 10:05:55 +01:00
2017-07-13 19:03:39 -04:00
2017-11-23 23:03:57 +05:30
2016-07-19 14:18:49 +01:00
2009-03-31 19:39:16 -04:00
2017-11-10 11:47:57 +00:00
2012-04-20 15:02:48 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-12 21:04:30 +01:00
2017-11-07 14:50:23 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-03 11:08:37 +00:00
2018-01-03 11:08:37 +00:00
2017-10-26 18:51:51 +02:00
2017-05-29 19:53:34 +02:00
2017-07-24 19:52:48 +02:00
2014-02-06 12:02:53 +00:00
2017-11-01 12:54:14 +00:00
2017-05-29 19:53:34 +02:00
2017-12-04 11:42:58 +00:00
2017-05-29 19:53:34 +02:00
2017-10-26 14:08:42 +02:00
2017-05-29 19:53:34 +02:00
2017-11-07 14:51:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-05 20:42:06 +00:00
2017-05-29 19:53:34 +02:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-02-02 10:05:55 +01:00
2018-02-02 10:05:55 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-10-26 12:27:17 +01:00
2017-05-29 19:53:34 +02:00
2017-11-17 11:28:43 +00:00
2017-05-29 19:53:34 +02:00
2018-01-31 22:25:02 +00:00
2017-05-29 19:53:34 +02:00
2017-09-11 22:14:18 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-12-04 10:38:01 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-09 15:17:02 +00:00
2018-01-12 15:29:29 +00:00
2017-04-10 10:38:31 +01:00
2015-01-30 16:58:40 +01:00
2018-01-05 19:29:35 +00:00
2018-01-05 19:29:35 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-11 16:03:05 +00:00
2017-05-29 19:53:34 +02:00
2017-06-05 16:07:52 +01:00
2017-05-29 19:53:34 +02:00
2017-11-17 11:28:43 +00:00
2017-05-29 19:53:34 +02:00
2018-02-02 10:07:12 +01:00
2017-05-29 19:53:34 +02:00
2018-01-12 15:29:29 +00:00
2017-05-29 19:53:34 +02:00
2017-08-07 17:31:31 +01:00
2017-05-29 19:53:34 +02:00
2017-06-28 19:50:57 -04:00
2017-11-07 14:51:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-10-11 16:36:20 +01:00
2017-05-29 19:53:34 +02:00
2017-12-04 11:42:58 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-11 15:31:17 +00:00
2017-05-29 19:53:34 +02:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-11-28 14:28:50 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-08 16:28:34 +01:00
2018-01-08 16:28:34 +01:00
2017-08-03 10:21:13 +01:00
2017-05-29 17:57:39 -04:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-07 14:51:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-07-18 17:31:29 -04:00
2018-01-15 18:26:56 +00:00
2018-01-15 18:26:56 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-12 16:36:16 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-06-09 16:45:09 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2016-06-15 16:15:12 -04:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-04 11:01:40 -05:00
2017-08-18 14:46:23 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-09 10:47:14 +01:00
2017-06-06 11:11:58 +02:00
2017-05-29 19:53:34 +02:00
2017-11-07 13:46:56 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-08-18 14:46:23 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-04 22:19:30 +01:00
2016-06-15 16:15:12 -04:00
2017-11-07 14:51:12 +00:00
2012-12-06 13:30:31 -05:00
2013-01-13 13:05:15 -05:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2018-01-04 11:01:40 -05:00
2018-01-04 11:01:40 -05:00
2018-01-18 10:12:26 +00:00
2018-01-04 11:01:40 -05:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-10-26 14:08:42 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-10-02 15:30:23 +01:00
2017-10-11 10:22:23 +01:00
2017-09-12 12:32:20 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-12-19 18:51:00 +08:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-12-08 11:10:27 +00:00
2017-11-01 12:46:38 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-12-04 11:42:58 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-01 12:46:38 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-17 11:28:43 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-07 14:51:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-28 14:14:19 +00:00
2017-05-29 19:53:34 +02:00
2018-01-08 11:50:26 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-02-01 14:58:28 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-06-03 10:30:17 +02:00
2017-06-03 10:30:17 +02:00
2018-02-01 14:58:28 +00:00
2018-01-09 16:24:27 +00:00
2018-01-09 16:24:27 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-12-04 11:42:58 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-23 14:24:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-08 15:16:19 +00:00
2017-06-03 10:30:17 +02:00
2017-10-17 14:10:31 +01:00
2017-05-29 19:53:34 +02:00
2017-12-11 11:40:14 +00:00
2017-12-01 10:02:21 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-31 22:37:18 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-03 14:07:57 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-02-01 14:58:28 +00:00
2017-11-29 17:50:27 +00:00
2018-02-01 14:58:29 +00:00
2017-05-29 19:53:34 +02:00
2017-11-27 12:36:03 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-02-01 14:58:28 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-15 03:24:29 -08:00
2017-05-29 19:53:34 +02:00
2017-11-14 15:13:44 -08:00
2017-05-29 19:53:34 +02:00
2017-12-06 10:33:52 +00:00
2016-01-08 12:31:18 +09:00
2016-01-08 12:31:18 +09:00
2017-11-04 20:05:37 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-02-02 14:41:00 +01:00
2017-10-23 12:20:02 +01:00
2017-05-29 19:53:34 +02:00
2017-11-07 14:51:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-12 15:29:29 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-10-26 13:48:39 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-02-01 14:58:28 +00:00
2017-05-29 19:53:34 +02:00
2018-01-08 11:50:26 +00:00
2017-10-16 11:14:57 +01:00
2017-12-04 11:42:58 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-12 15:29:29 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-29 17:50:27 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-12-25 00:12:06 -08:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-10-26 18:51:51 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-10-26 18:51:51 +02:00
2017-05-29 19:53:34 +02:00
2017-11-07 14:51:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-02-02 18:05:27 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-09-13 17:38:42 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-08 19:17:01 -06:00
2018-01-08 19:17:01 -06:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-07 14:51:12 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-09-21 12:05:06 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-30 15:31:13 +01:00
2017-10-26 00:19:23 +01:00
2017-08-03 10:21:13 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-12-04 11:42:58 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-11-12 16:36:16 +01:00
2017-05-29 19:53:34 +02:00
2017-10-11 13:18:49 +01:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-18 10:12:26 +00:00
2018-01-18 10:12:26 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-06-01 11:00:28 +00:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2018-01-17 12:59:51 +00:00
2018-02-02 18:05:27 +01:00
2017-06-03 10:30:17 +02:00
2017-06-03 10:30:17 +02:00
2017-06-03 10:30:17 +02:00
2017-06-03 10:30:17 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00
2017-05-29 19:53:34 +02:00