Backport patch to build without HTTP2

It's causing problems for people. For more information, see:
https://src.fedoraproject.org/rpms/ostree/pull-request/6
This commit is contained in:
Jonathan Lebon 2017-12-18 17:22:38 +00:00
parent 7198ec08c4
commit 263e4d5e7a
4 changed files with 71 additions and 85 deletions

View File

@ -0,0 +1,66 @@
From 20984db8bd2dbe6edca9a9c2a042aed32142dab7 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Tue, 12 Dec 2017 16:04:11 -0500
Subject: [PATCH] build-sys: Add --disable-http2
I may punt and use this in Fedora at least for now until we have time to debug
the issues.
Closes: #1373
Approved by: jlebon
---
configure.ac | 10 ++++++++++
src/libostree/ostree-fetcher-curl.c | 2 ++
2 files changed, 12 insertions(+)
diff --git a/configure.ac b/configure.ac
index 629c923b..050da747 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,6 +135,15 @@ AS_IF([test x$with_curl != xno ], [
], [with_soup_default=check])
AM_CONDITIONAL(USE_CURL, test x$with_curl != xno)
if test x$with_curl = xyes; then OSTREE_FEATURES="$OSTREE_FEATURES libcurl"; fi
+AC_ARG_ENABLE(http2,
+AS_HELP_STRING([--disable-http2],
+ [Disable use of http2 (default: no)]),,
+ [enable_http2=yes])
+AS_IF([test x$enable_http2 != xno ], [
+ AC_DEFINE([BUILDOPT_HTTP2], 1, [Define if we enable http2])
+], [
+ OSTREE_FEATURES="$OSTREE_FEATURES no-http2"
+])
dnl When bumping the libsoup-2.4 dependency, remember to bump
dnl SOUP_VERSION_MIN_REQUIRED and SOUP_VERSION_MAX_ALLOWED in
@@ -556,6 +565,7 @@ AC_OUTPUT
echo "
libostree $VERSION ($release_build_type)
+ features: $OSTREE_FEATURES
===============
diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c
index 58835529..291df3db 100644
--- a/src/libostree/ostree-fetcher-curl.c
+++ b/src/libostree/ostree-fetcher-curl.c
@@ -771,6 +771,7 @@ initiate_next_curl_request (FetcherRequest *req,
* there are numerous HTTP/2 fixes since the original version in
* libcurl 7.43.0.
*/
+#ifdef BUILDOPT_HTTP2
#if CURL_AT_LEAST_VERSION(7, 51, 0)
curl_easy_setopt (req->easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
#endif
@@ -778,6 +779,7 @@ initiate_next_curl_request (FetcherRequest *req,
#if (CURLPIPE_MULTIPLEX > 0)
/* wait for pipe connection to confirm */
curl_easy_setopt (req->easy, CURLOPT_PIPEWAIT, 1L);
+#endif
#endif
curl_easy_setopt (req->easy, CURLOPT_WRITEFUNCTION, write_cb);
if (g_getenv ("OSTREE_DEBUG_HTTP"))
--
2.14.3

View File

@ -1,41 +0,0 @@
From 176a7b4778fbacbbb0824cf8c612656cd0985499 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Tue, 7 Nov 2017 16:10:45 +0100
Subject: [PATCH] fetcher/curl: Fix invalid memory access in finalize()
Reorder cleanup functions so that curl_multi_cleanup() runs before
self->sockets is destroyed. This avoids an assert and invalid memory
access in sock_cb where self->sockets is dereferenced during
curl_multi_cleanup().
Closes: https://github.com/ostreedev/ostree/issues/1331
Closes: #1332
Approved by: cgwalters
---
src/libostree/ostree-fetcher-curl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c
index 1f64188258ed..8a23b16361ef 100644
--- a/src/libostree/ostree-fetcher-curl.c
+++ b/src/libostree/ostree-fetcher-curl.c
@@ -167,6 +167,7 @@ _ostree_fetcher_finalize (GObject *object)
{
OstreeFetcher *self = OSTREE_FETCHER (object);
+ curl_multi_cleanup (self->multi);
g_free (self->remote_name);
g_free (self->cookie_jar_path);
g_free (self->proxy);
@@ -177,7 +178,6 @@ _ostree_fetcher_finalize (GObject *object)
g_clear_pointer (&self->timer_event, (GDestroyNotify)destroy_and_unref_source);
if (self->mainctx)
g_main_context_unref (self->mainctx);
- curl_multi_cleanup (self->multi);
G_OBJECT_CLASS (_ostree_fetcher_parent_class)->finalize (object);
}
--
2.14.2

View File

@ -1,43 +0,0 @@
From 69e00fc506e6a6d368a6e276eeb376e3d88b2fc7 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Mon, 27 Nov 2017 11:05:07 -0500
Subject: [PATCH] fetcher/curl: Stop using CURLOPT_LOW_SPEED_TIME/_LIMIT
They don't play nicely currently with HTTP2 where we may
have lots of requests queued.
https://github.com/ostreedev/ostree/issues/878#issuecomment-347228854
In practice anyways I think issues here are better solved on a higher level -
e.g. apps today can use an overall timeout on pulls and if they exceed the limit
set the cancellable.
Closes: #1349
Approved by: alexlarsson
---
src/libostree/ostree-fetcher-curl.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/libostree/ostree-fetcher-curl.c b/src/libostree/ostree-fetcher-curl.c
index 8a23b163..58835529 100644
--- a/src/libostree/ostree-fetcher-curl.c
+++ b/src/libostree/ostree-fetcher-curl.c
@@ -788,8 +788,13 @@ initiate_next_curl_request (FetcherRequest *req,
curl_easy_setopt (req->easy, CURLOPT_PROGRESSFUNCTION, prog_cb);
curl_easy_setopt (req->easy, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt (req->easy, CURLOPT_CONNECTTIMEOUT, 30L);
- curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_LIMIT, 1L);
- curl_easy_setopt (req->easy, CURLOPT_LOW_SPEED_TIME, 30L);
+ /* We used to set CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME
+ * here, but see https://github.com/ostreedev/ostree/issues/878#issuecomment-347228854
+ * basically those options don't play well with HTTP2 at the moment
+ * where we can have lots of outstanding requests. Further,
+ * we could implement that functionality at a higher level
+ * more consistently too.
+ */
/* closure bindings -> task */
curl_easy_setopt (req->easy, CURLOPT_PRIVATE, task);
--
2.14.2

View File

@ -1,10 +1,11 @@
Summary: Tool for managing bootable, immutable filesystem trees
Name: ostree
Version: 2017.14
Release: 1%{?dist}
Release: 2%{?dist}
Source0: https://github.com/ostreedev/%{name}/releases/download/v%{version}/libostree-%{version}.tar.xz
# https://bugzilla.redhat.com/show_bug.cgi?id=1451458
Source1: 91-ostree.preset
Patch0: 0001-build-sys-Add-disable-http2.patch
License: LGPLv2+
URL: https://ostree.readthedocs.io/en/latest/
@ -158,6 +159,9 @@ install -D -m 0644 %{SOURCE1} %{buildroot}%{_prefix}/lib/systemd/system-preset/9
%{_libexecdir}/libostree/ostree-trivial-httpd
%changelog
* Mon Dec 18 2017 Jonathan Lebon <jlebon@redhat.com> - 2017.14-2
- Backport patch to drop HTTP2
* Mon Dec 04 2017 Colin Walters <walters@verbum.org> - 2017.14-1
- https://github.com/ostreedev/ostree/releases/tag/v2017.14
- Update description