13c4b9579b
`mock-resolver.c` is a mock implementation of `GResolver` used in the `network-address` tests. It returns resolver results, and implements timeouts, as directed by the test calling it. In particular, it allows the IPv4 and IPv6 resolver results to be returned using independent delays. This allows code paths which deal with IPv4 and IPv6 results being returned at different times to be tested, as the ‘Happy Eyeballs’ spec mandates various hard-coded timeouts for returning the best results it can in a reasonable timeframe. Previously, `mock-resolver.c` implemented the timeouts by handling `lookup_by_name()` in a `GTask` worker thread, and calling `g_usleep()` for the timeout. This seemed to cause occasional CI failures, such as https://gitlab.gnome.org/GNOME/glib/-/jobs/1843454, where a resolver error would be returned rather than the expected results: ``` ok 52 /network-address/happy-eyeballs/ipv4-error-ipv6-first \# GLib-GIO-DEBUG: IPv4 DNS error: IPv4 Broken (/var/tmp/gitlab_runner/builds/Ff4WDDRj/0/GNOME/glib/_build/gio/tests/network-address:18428): GLib-GIO-DEBUG: 09:03:08.587: IPv4 DNS error: IPv4 Broken Bail out! GLib-GIO:ERROR:../gio/tests/network-address.c:586:got_addr: assertion failed (error == NULL): IPv4 Broken (g-io-error-quark, 24) stderr: ** GLib-GIO:ERROR:../gio/tests/network-address.c:586:got_addr: assertion failed (error == NULL): IPv4 Broken (g-io-error-quark, 24) ``` While I’ve been unable to reproduce these failures locally, I suspect they might be down to thread spawning occasionally taking long enough on a CI runner to change the ordering of the timeouts, such that the ‘Happy Eyeballs’ algorithm returns a different set of results from what the test expects. So, this commit rewrites part of `mock-resolver.c` to implement timeouts in the main thread, rather than in a worker thread. That should eliminate the delays in spawning threads, and should mean that the timeout sources in `mock-resolver.c` are attached to the same `GMainContext` as those from the ‘Happy Eyeballs’ algorithm which are monitoring them, so a total order over the timeouts can be guaranteed. Of course, I might be completely wrong since this is just a guess and I can’t properly test it since I can’t reproduce the failure. Worth a try. Signed-off-by: Philip Withnall <pwithnall@endlessos.org> |
||
---|---|---|
.gitlab-ci | ||
docs | ||
fuzzing | ||
gio | ||
glib | ||
gmodule | ||
gobject | ||
gthread | ||
m4macros | ||
po | ||
subprojects | ||
tests | ||
.clang-format | ||
.dir-locals.el | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.gitlab-ci.yml | ||
AUTHORS | ||
check-abis.sh | ||
clang-format-diff.py | ||
CONTRIBUTING.md | ||
COPYING | ||
glib-gettextize.in | ||
glib.doap | ||
glib.supp | ||
HACKING | ||
INSTALL.in | ||
meson_options.txt | ||
meson.build | ||
msvc_recommended_pragmas.h | ||
NEWS | ||
NEWS.pre-1-3 | ||
README | ||
README.md | ||
README.rationale | ||
README.win32 | ||
README.win32.md | ||
SECURITY.md | ||
template-tap.test.in | ||
template.test.in |
GLib
GLib is the low-level core library that forms the basis for projects such as GTK and GNOME. It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.
The official download locations are: https://download.gnome.org/sources/glib
The official web site is: https://www.gtk.org/
Installation
See the file 'INSTALL.in'
Supported versions
Only the most recent unstable and stable release series are supported. All older versions are not supported upstream and may contain bugs, some of which may be exploitable security vulnerabilities.
See SECURITY.md for more details.
Documentation
API documentation is available online for GLib for the:
Discussion
If you have a question about how to use GLib, seek help on GNOME’s Discourse
instance. Alternatively, ask a question
on StackOverflow and tag it glib
.
Reporting bugs
Bugs should be reported to the GNOME issue tracking system. You will need to create an account for yourself. You may also submit bugs by e-mail (without an account) by e-mailing incoming+gnome-glib-658-issue-@gitlab.gnome.org, but this will give you a degraded experience.
Bugs are for reporting problems in GLib itself, not for asking questions about how to use it. To ask questions, use one of our discussion forums.
In bug reports please include:
- Information about your system. For instance:
- What operating system and version
- For Linux, what version of the C library
- And anything else you think is relevant.
- How to reproduce the bug.
- If you can reproduce it with one of the test programs that are built
in the
tests/
subdirectory, that will be most convenient. Otherwise, please include a short test program that exhibits the behavior. As a last resort, you can also provide a pointer to a larger piece of software that can be downloaded.
- If you can reproduce it with one of the test programs that are built
in the
- If the bug was a crash, the exact text that was printed out when the crash occurred.
- Further information such as stack traces may be useful, but is not necessary.
Contributing to GLib
Please follow the contribution guide to know how to start contributing to GLib.
Patches should be submitted as merge requests to gitlab.gnome.org. If the patch fixes an existing issue, please refer to the issue in your commit message with the following notation (for issue 123):
Closes: #123
Otherwise, create a new merge request that introduces the change. Filing a separate issue is not required.
Default branch renamed to main
The default development branch of GLib has been renamed to main
. To update
your local checkout, use:
git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main