-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libcurl backend #641
libcurl backend #641
Conversation
d8a591f
to
525a91a
Compare
OK, so things seem to be in a state useful to look at from an architecture perspective. The biggest outstanding thing is a URL parser (yes, this is very sad, leaning towards importing a copy of libsoup's). |
OK, squashed and rebased. Still WIP though. |
Moving cleanup dependencies to #651 |
dbc0b7e
to
a9aa678
Compare
Split out, cleaned up prep patches in #654 |
For rpm-ostree, we already link to libcurl indirectly via librepo, and only having one HTTP library in process makes sense. Further, libcurl is (I think) more popular in the embedded space. It also supports HTTP/2.0 today, which is a *very* nice to have for OSTree. This seems to be working fairly well for me in my local testing, but it's obviously brand new nontrivial code, so it's going to need some soak time. The ugliest part of this is having to vendor in the soup-url code. With Oxidation we could follow the path of Firefox and use the [Servo URL parser](https://github.com/servo/rust-url). Having to redo cookie parsing also sucked, and that would also be a good oxidation target. But that's for the future.
Rebased 🏄. Removing the WIP label. I think we can land this and just note that it's still experimental. |
return FALSE; | ||
} | ||
} | ||
#else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any practical reason not to use the agnostic version for both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm...it's net-new code that affects the libsoup path too. But it seems fairly safe though too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be a great way to have it battle tested. :) My original intent though was just to try to minimize conditional paths wherever possible. Though if you'd prefer keeping them separate for now, that's fine (would still be nice to export them into functions though).
@@ -69,6 +70,52 @@ ot_remote_builtin_delete_cookie (int argc, char **argv, GCancellable *cancellabl | |||
cookie_file = g_strdup_printf ("%s.cookies.txt", remote_name); | |||
jar_path = g_build_filename (gs_file_get_path_cached (repo->repodir), cookie_file, NULL); | |||
|
|||
#ifdef HAVE_LIBCURL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put these implementations in their own functions in ot-remote-cookie-util.c
?
.redhat-ci.yml
Outdated
--libdir=/usr/lib64 | ||
--enable-installed-tests | ||
--enable-gtk-doc | ||
--enable-curl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be --with-curl
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output from the curl
tester:
libOSTree 2017.1
===============
introspection: yes
Rust (internal oxidation): no
rofiles-fuse: yes
HTTP backend: libsoup
...
OK, centralized the cookie 🍪 bits more. |
OK, no performance regressions to note when pulling from a remote server. However, pulling from a local httpd, I easily get
It looks like it's pipelining requests, which is nice. But the requests are being sent faster than we can write them to disk, so we eventually hit our open fd resource limit. This worked for me: diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h
index 73e0244..48de3ba 100644
--- a/src/libostree/ostree-repo-private.h
+++ b/src/libostree/ostree-repo-private.h
@@ -35,6 +35,16 @@ G_BEGIN_DECLS
#define _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS 8
#define _OSTREE_MAX_OUTSTANDING_DELTAPART_REQUESTS 2
+/* In most cases, writing to disk should be much faster than
+ * fetching from the network, so we shouldn't actually hit
+ * this. But if using pipelining and e.g. pulling over LAN
+ * (or writing to slow media), we can have a runaway
+ * situation towards EMFILE.
+ * */
+#define _OSTREE_MAX_OUTSTANDING_WRITE_REQUESTS \
+ (_OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS * 2)
+
+
typedef enum {
OSTREE_REPO_TEST_ERROR_PRE_COMMIT = (1 << 0)
} OstreeRepoTestErrorFlags;
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 295973e..1323a8e 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -353,7 +353,10 @@ fetcher_queue_is_full (OtPullData *pull_data)
return (pull_data->n_outstanding_metadata_fetches +
pull_data->n_outstanding_content_fetches +
pull_data->n_outstanding_deltapart_fetches) == _OSTREE_MAX_OUTSTANDING_FETCHER_REQUESTS ||
- pull_data->n_outstanding_deltapart_fetches == _OSTREE_MAX_OUTSTANDING_DELTAPART_REQUESTS;
+ pull_data->n_outstanding_deltapart_fetches == _OSTREE_MAX_OUTSTANDING_DELTAPART_REQUESTS ||
+ (pull_data->n_outstanding_metadata_write_requests +
+ pull_data->n_outstanding_content_write_requests +
+ pull_data->n_outstanding_deltapart_write_requests) >= _OSTREE_MAX_OUTSTANDING_WRITE_REQUESTS;
}
static gboolean It's not a tight max, since we always want to start the write when a fetch completes (hence the |
Can you convert this to a commit and submit as a PR? I think it looks good, though can we do something like:
? |
I don't see a strong connection between "max outstanding local writes" and "max http requests" - let's just hardcode it like |
Sure, that works. My reasoning was that each outstanding request will eventually become an outstanding write so you can end up with |
OK, I opened #675. |
For rpm-ostree, we already link to libcurl indirectly via librepo, and only having one HTTP library in process makes sense. Further, libcurl is (I think) more popular in the embedded space. It also supports HTTP/2.0 today, which is a *very* nice to have for OSTree. This seems to be working fairly well for me in my local testing, but it's obviously brand new nontrivial code, so it's going to need some soak time. The ugliest part of this is having to vendor in the soup-url code. With Oxidation we could follow the path of Firefox and use the [Servo URL parser](https://github.com/servo/rust-url). Having to redo cookie parsing also sucked, and that would also be a good oxidation target. But that's for the future. Closes: #641 Approved by: jlebon
@rh-atomic-bot retry |
☀️ Test successful - status-atomicjenkins |
TODO: