Commit Graph
1902 Commits
Author SHA1 Message Date
Wez Furlong 6e2143cd8e ready_queue: micro optimization: reduce scope of ReadyQueue lock
Doesn't materially change profiling, but it is obviously
better to hold locks for less time.
2024-05-01 22:35:05 -07:00
Wez Furlong 8246dec7db egress_source: add more debug diagnostics to socks5 auth 2024-05-01 13:05:51 -07:00
Wez Furlong 33b819e019 ready_queue: maintainer_task: fixup lock scoping
Welp, a4e4ea23f5 kept the lock alive
across a sleep, which is bad.

Fix that up!
2024-05-01 07:13:36 -07:00
ncai 24e2c14ed4 add ready_count metrics to remove on site reap 2024-05-01 06:18:03 -07:00
Wez Furlong a4e4ea23f5 ready_queue: maintainer_task: run a couple of times on startup
I've seen some flakey behavior in some of the low traffic integration
tests, where it looks like the maintainer isn't triggering to establish
connections.

This commit adjusts the logic in the maintainer_task to trigger
the maintainer a handful of times over the first few seconds of
its life to account for timing issues when setting up a new
ready queue on a busy server.
2024-05-01 06:15:09 -07:00
Wez Furlong 57565514d9 egress_source: add preliminary support for socks5 auth
This commit adds two new fields to the egress source definition:

* socks5_proxy_username - string
* socks5_proxy_password - keysource
  (https://docs.kumomta.com/reference/keysource/)

when present, the socks5 client will indicate that it is capable
of doing username/password authentication per
https://www.rfc-editor.org/rfc/rfc1928

The password is specified as a keysource, which allows it to
load credentials from a vault or a file in addition to a
string.

This is untested beyond compilation, so there are currently
no docs for this.
2024-05-01 06:15:08 -07:00
Tom Mairs 413590e22b add notes for starting and enabling tsa daemon 2024-04-30 23:45:10 +00:00
Wez Furlong 804d72dc5c throttle: add explicit error when attempting 0/sec rate
Limits must be non-zero; raise an error when trying to use
a limit of 0.
2024-04-30 14:17:03 -07:00
Wez Furlong afe326f01a smtp_dispatcher: improve error context for troubleshooting/diagnostics 2024-04-30 14:10:00 -07:00
Mike Hillyer 3ec640a1d4 Update FAQ to make it clear about directory access permissions. 2024-04-29 13:33:00 -04:00
Wez Furlong 9e95303e6b add kumo.available_parallelism()
This can be helpful for writing configuration files for systems
that scale to the available compute resources.
2024-04-29 08:23:27 -07:00
Wez Furlong 900721ceec deps: ensure data-encoding version is a workspace dep 2024-04-29 08:01:42 -07:00
dependabot[bot] 005f757339 build(deps): bump the all group across 1 directory with 8 updates
Bumps the all group with 8 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [data-encoding](https://github.com/ia0/data-encoding) | `2.5.0` | `2.6.0` |
| [reqwest](https://github.com/seanmonstar/reqwest) | `0.12.3` | `0.12.4` |
| [serde](https://github.com/serde-rs/serde) | `1.0.198` | `1.0.199` |
| [async-recursion](https://github.com/dcchut/async-recursion) | `1.1.0` | `1.1.1` |
| [minijinja-contrib](https://github.com/mitsuhiko/minijinja) | `1.0.20` | `2.0.1` |
| [minijinja](https://github.com/mitsuhiko/minijinja) | `1.0.20` | `2.0.1` |
| [thiserror](https://github.com/dtolnay/thiserror) | `1.0.58` | `1.0.59` |
| [data-encoding-macro](https://github.com/ia0/data-encoding) | `0.1.14` | `0.1.15` |



Updates `data-encoding` from 2.5.0 to 2.6.0
- [Commits](https://github.com/ia0/data-encoding/commits)

Updates `reqwest` from 0.12.3 to 0.12.4
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/seanmonstar/reqwest/compare/v0.12.3...v0.12.4)

Updates `serde` from 1.0.198 to 1.0.199
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.198...v1.0.199)

Updates `async-recursion` from 1.1.0 to 1.1.1
- [Release notes](https://github.com/dcchut/async-recursion/releases)
- [Commits](https://github.com/dcchut/async-recursion/compare/v1.1.0...v1.1.1)

Updates `minijinja-contrib` from 1.0.20 to 2.0.1
- [Release notes](https://github.com/mitsuhiko/minijinja/releases)
- [Changelog](https://github.com/mitsuhiko/minijinja/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/minijinja/compare/1.0.20...2.0.1)

Updates `minijinja` from 1.0.20 to 2.0.1
- [Release notes](https://github.com/mitsuhiko/minijinja/releases)
- [Changelog](https://github.com/mitsuhiko/minijinja/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/minijinja/compare/1.0.20...2.0.1)

Updates `thiserror` from 1.0.58 to 1.0.59
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.58...1.0.59)

Updates `data-encoding-macro` from 0.1.14 to 0.1.15
- [Commits](https://github.com/ia0/data-encoding/commits)

---
updated-dependencies:
- dependency-name: data-encoding
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: reqwest
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: async-recursion
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: minijinja-contrib
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all
- dependency-name: minijinja
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: data-encoding-macro
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-29 07:58:54 -07:00
Wez Furlong e67eedb829 add comments to explain site_name situation with TSA
See also:
 47cda59f1b
 e461ec41b5

https://github.com/KumoCorp/kumomta/pull/175
2024-04-29 07:55:59 -07:00
Nathalie Caiandncai e461ec41b5 tsa - Extract site_name from record site (#175)
* extract site_name from record site

Co-authored-by: ncai <ncai@chapsvision.com>
2024-04-29 07:48:52 -07:00
Wez Furlong 850b64d48c fix: ready queue gets stuck when TSA suspends before MAIL FROM
This sequence of events:

1. Messages are flowing
2. The remote site starts to return a 421 for mail at connection
   time, prior to MAIL FROM, on new connections
3. The local site employs a TSA rule that suspends the corresponding
   ready queue

Could result in the contents of that ready_queue getting stuck.

Here's a representation of the logs:

```
Apr 24 19:03:44 maintain SITENAME: computed ideal connection count as 3
Apr 24 19:03:44 Error in Dispatcher::run for SITENAME: connect to ResolvedAddress { name: "smtp-in.orange.fr.", addr: 80.12.26.32 } port 25 and read initial banner: Command rejected Response { code: 421, enhanced_code: None, content: "XXXXX smtp.orange.fr XXXXX Service refuse. Veuillez essayer plus tard. Service refused, please try later. OFR_999 [999]", command: None } (consecutive_connection_failures=1)
Apr 24 19:03:45 maintain SITENAME: there are now 3 connections, suspended(via config)=false, suspended(admin)=false, queue_size=691
Apr 24 19:03:45 maintain SITENAME: computed ideal connection count as 3
Apr 24 19:03:45 maintain SITENAME: there are now 3 connections, suspended(via config)=false, suspended(admin)=true, queue_size=746
... the above repeats every minute for a while ...
Apr 24 19:03:45 maintain SITENAME: computed ideal connection count as 0
Apr 24 19:13:45 maintain SITENAME: there are now 3 connections, suspended(via config)=false, suspended(admin)=true, queue_size=746
Apr 24 19:13:45 maintain SITENAME: computed ideal connection count as 0
Apr 24 19:13:45 reaping site SITENAME
Apr 24 19:23:44 maintain SITENAME: there are now 0 connections, suspended(via config)=false, suspended(admin)=false, queue_size=1
```

There are two problems:

1. The main mechanism that acts to sweep the read queue into the
   scheduled queue is only triggered once we get past the initial
   connection phase, causing messages to be retained in the
   ready queue instead of moving back into the scheduled queue.
2. The is-reapable logic doesn't consider the number of messages
   that may be in the ready queue. It was written before we had
   a suspension concept and only considers that an ideal connection
   count of 0 implies that there are no messages.
   The result is, in combination with 1, is that we can reap the ready
   queue while it contains messages and forget about them until
   the server is restarted.

This commit resolves both of these issues:

1. The maintain routine will now act to sweep messages into the
   corresponding scheduled queue if an admin suspension is active.
   In addition, this same sweep is considered when we reap the
   ready queue, just in case some other logic bug manifests in
   the future with the same consequences.
2. The reap logic now also requires that the ready queue be empty.
2024-04-25 07:23:39 -07:00
Wez Furlong 16f34ff1bf ready_queue: add more trace diagnostics 2024-04-24 08:42:27 -07:00
Wez Furlong 49e4e25045 ci: remove arc runner test workflow 2024-04-20 15:35:09 -07:00
Wez Furlong 4272b4a316 ci: improve parallelism in build graph
We can overlap some of the cache operations; we were already
doing this in the ubuntu flow, but hadn't ported it over
to the other flows until now.
2024-04-20 15:25:44 -07:00
Wez Furlong 84c88f2eff ci: add sccache to builder image 2024-04-20 08:09:18 -07:00
Wez Furlong 1cc78033d7 ci: add jq to builder, build builder when builder changes 2024-04-20 07:24:59 -07:00
Wez Furlong a768c6dc79 update-openapi.sh: only run when jq is available
This script is triggered as part of `make test` which is not
really a great place for it.

Its purpose is to extract the auto-generated openapi spec
from the kumod and tsa binaries and update the snapshot
that is present in the docs.

It needs kumod and tsa-daemon to have been built in debug mode
to run successfully.

It piggy-backs on `make test` on the assumption that it will
cause the person who is making changes to it to include those
spec updates in their commit/PR.

Since `make test` invokes it, the various builders may try
and fail to execute jq in the `test` step.  This is mostly
harmless, but looks noisy in the logs.

The ideal situation for this would be:

* at PR time and push time: add a check that runs this script and that
  fails if the specs are updated for the docs and are not part of the PR
  itself. (eg: status is dirty after running it).
  This way it will be visible from the CI state that something is awry.
2024-04-20 07:17:02 -07:00
Wez Furlong c9d23346e4 ci: rebuild builder images on a weekly schedule 2024-04-20 00:27:26 -07:00
Wez Furlong 3daf65b383 ci: switch to ghcr.io builder images 2024-04-20 00:05:16 -07:00
Wez Furlong c3f2d1a584 ci: use matrix build for images 2024-04-20 00:02:41 -07:00
Wez Furlong 8fe05193e3 ci: fixup copypasta 2024-04-19 23:44:21 -07:00
Wez Furlong b5507e0caa ci: tweak docker publish for builder images 2024-04-19 23:42:17 -07:00
Wez Furlong 5a9d3eea1d ci: add builder image builder 2024-04-19 23:34:25 -07:00
Wez Furlong 4a59967ce5 ci: split build into test and (release) build 2024-04-19 21:22:48 -07:00
Wez Furlong 83204d8902 ci: arrange to clear build cache on cron
The idea is that we skip restoring from cache when
triggered from cron, so that we push a whole new
cache set to replace the old one.
2024-04-19 18:54:17 -07:00
Wez Furlong 3261d1517f redis: add connect_timeout option
closes: https://github.com/KumoCorp/kumomta/issues/168
2024-04-19 12:33:23 -07:00
Wez Furlong 8c2502a792 ci: constrain push to main branch
goal is to avoid dependabot branches getting build out
in addition to the PR
2024-04-19 11:56:07 -07:00
Wez Furlong eec95e3e31 ci: constrain doc build to pushes to main 2024-04-19 11:54:10 -07:00
Wez Furlong c5da71e6d7 ci: try to refine condition 2024-04-19 11:52:20 -07:00
Wez Furlong 719e8a915e ci: adjust path syntax 2024-04-19 11:38:02 -07:00
Wez Furlong 601aa0dee8 ci: try alternative when syntax
ideally no functional change here
2024-04-19 11:36:15 -07:00
Wez Furlong c899e7c85f ci: revert when condition changes
The docs don't match the schema, which I can't be bothered to run down
and reverse engineer from the code right now.

I'll see if I can find another way to make this work.
2024-04-19 11:21:57 -07:00
Wez Furlong e8646df180 ci: try again!
Have I mentioned that I hate yaml?
2024-04-19 11:17:38 -07:00
Wez Furlong 1f7730ed1f ci: try again at the when condition
It's poorly documented and the last attempt generated a lot of warnings.
2024-04-19 11:15:15 -07:00
Wez Furlong 7a20e56913 ci: avoid running dependabot branches AND PRs
just keep the builds running on the main branch for now
2024-04-19 11:04:53 -07:00
Wez Furlong 1d17a3a5db kumod: logging: migrate from deprecated minijinja functions 2024-04-19 10:30:40 -07:00
Wez Furlong e98fa9e94e cargo update to pick up resolution for RUSTSEC-2024-0336
See https://rustsec.org/advisories/RUSTSEC-2024-0336
2024-04-19 10:24:22 -07:00
Wez Furlong 3ad5856021 memoize: add thundering herd protection
If many calls are made to the memoized function with the same parameters
at the time that the cache is empty/expired, then each of those
concurrent calls will proceed to compute and populate the cache.  This
is known as a thundering herd, and can be painful if the amount of work
performed by the cache population function is high, or alternatively, if
the level of concurrency is high and some system resource is required to
satisfy the call, this can put the system under higher pressure.

This commit adds a simple mechanism to mitigate this: each combination
of cache and cache parameters is paired with an optional semaphore that
is used to constrain concurrency to a single call. This could be a
mutex, but using a semaphore allows future explicit control over the
concurrency level.
2024-04-19 09:11:51 -07:00
Wez Furlong b4aa4a38ec http: allow controlling some timeout and diagnostics on the client
Adds a couple of options that provide more control over the default
timeouts and logging.

These are exposed to the shaping helper as `publish_timeout`,
`publish_pool_idle_timeout` and `publish_connection_verbose`.
2024-04-19 07:44:19 -07:00
Wez Furlong 69a89ff08c ci: avoid more deprecated syntax 2024-04-18 06:51:17 -07:00
Wez Furlong 114c625e5a ci: update away from deprecated syntax 2024-04-18 06:48:03 -07:00
Wez Furlong eea86d4730 Testing ARC runners (#163)
Add workflow to test arc runners
https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/quickstart-for-actions-runner-controller
2024-04-17 19:30:36 -07:00
Mike Hillyer 080b38d9ad Add a warning to the webhooks helper about proper positioning of the log hooks and queue helper calls. 2024-04-16 14:57:09 -04:00
Wez Furlong af61dee616 docs: try re-enabling social card preview 2024-04-12 08:18:10 -07:00
Wez Furlong 415d4fc19c tsa: make the default queue config for tsa-daemon more aggressive
while troubleshooting a situation where the
http://127.0.0.1:8008.tsa.kumomta queue is backing up, I noticed that
we're using the default queue configuration for this queue.

Let's make it more inline with the defaults for webhooks; give it a
1 minute base retry with a 20 minute max.

These parameters are configurable; you can pass in `tsa_queue_config` to
the setup_with_automation call to specify your preferred values for the
scheduled queue config.
2024-04-10 14:17:23 -07:00