From 9aacf425dc2ec6e3284ffb1fce27ce55786627a2 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sun, 18 Aug 2024 14:55:17 -0700 Subject: [PATCH 1/3] fix: use http proxy for s3 access I don't know why the AWS sdk disabled it by default. It would be nice to have test coverage of the s3 store or proxies, but neither currently exist. Fixes: https://git.lix.systems/lix-project/lix/issues/433 Change-Id: If1e76169a3d66dbec2e926af0d0d0eccf983b97b --- doc/manual/rl-next/http-proxy-for-s3.md | 10 ++++++++++ src/libstore/s3-binary-cache-store.cc | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 doc/manual/rl-next/http-proxy-for-s3.md diff --git a/doc/manual/rl-next/http-proxy-for-s3.md b/doc/manual/rl-next/http-proxy-for-s3.md new file mode 100644 index 000000000..57b0107dd --- /dev/null +++ b/doc/manual/rl-next/http-proxy-for-s3.md @@ -0,0 +1,10 @@ +--- +synopsis: HTTP proxy environment variables are now respected for S3 binary cache stores +issues: [fj#433] +cls: [1788] +category: Fixes +credits: jade +--- + +Due to "legacy reasons" (according to the AWS C++ SDK docs), the AWS SDK ignores system proxy configuration by default. +We turned it back on. diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc index 4683f00f9..ffebfda8d 100644 --- a/src/libstore/s3-binary-cache-store.cc +++ b/src/libstore/s3-binary-cache-store.cc @@ -140,6 +140,8 @@ ref S3Helper::makeConfig( res->connectTimeoutMs = 5 * 1000; res->retryStrategy = std::make_shared(); res->caFile = settings.caFile; + // Use the system proxy env-vars in curl for s3, which is off by default for some reason + res->allowSystemProxy = true; return res; } From af546be20560c5e192b8cf8df5d28c94ea7a9832 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Thu, 22 Aug 2024 20:36:35 -0700 Subject: [PATCH 2/3] build: remove approximately 400 seconds of CPU time (30%) This took parsing time from 1421s or so to 1060s or so. The reason is entirely nlohmann. All of the stuff below is just Obliterated because it's built in the PCH instead: **** Templates that took longest to instantiate: 219051 ms: nlohmann::basic_json<>::parse (276 times, avg 793 ms) 169675 ms: nlohmann::basic_json<>::basic_json (1127 times, avg 150 ms) 129416 ms: nlohmann::detail::parser, nlohmann::detail::i... (276 times, avg 468 ms) 98155 ms: nlohmann::detail::parser, nlohmann::detail::i... (276 times, avg 355 ms) 81322 ms: nlohmann::basic_json<>::json_value::json_value (1405 times, avg 57 ms) 53531 ms: nlohmann::detail::json_sax_dom_callback_parser Date: Thu, 22 Aug 2024 20:41:40 -0700 Subject: [PATCH 3/3] libutil: delete unused boost context cruft This was from before we got rid of the boost coroutines. Now we don't need any of this code. Change-Id: Ief8e8ebc184f02f48e30cb253a66b540faa56329 --- src/libutil/serialise.hh | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh index 6c637bd35..8218db440 100644 --- a/src/libutil/serialise.hh +++ b/src/libutil/serialise.hh @@ -9,8 +9,6 @@ #include "types.hh" #include "file-descriptor.hh" -namespace boost::context { struct stack_context; } - namespace nix { @@ -612,23 +610,6 @@ struct FramedSink : nix::BufferedSink }; }; -/** - * Stack allocation strategy for sinkToSource. - * Mutable to avoid a boehm gc dependency in libutil. - * - * boost::context doesn't provide a virtual class, so we define our own. - */ -struct StackAllocator { - virtual boost::context::stack_context allocate() = 0; - virtual void deallocate(boost::context::stack_context sctx) = 0; - - /** - * The stack allocator to use in sinkToSource and potentially elsewhere. - * It is reassigned by the initGC() method in libexpr. - */ - static StackAllocator *defaultAllocator; -}; - /* Disabling GC when entering a coroutine (without the boehm patch). mutable to avoid boehm gc dependency in libutil. */