Joey Hess [Mon, 29 Jul 2024 13:11:27 +0000 (09:11 -0400)]
idea
Joey Hess [Mon, 29 Jul 2024 01:11:23 +0000 (21:11 -0400)]
remove unused imports
Joey Hess [Mon, 29 Jul 2024 00:29:42 +0000 (20:29 -0400)]
remove uuid from annex+http urls
Not needed it turns out.
Joey Hess [Mon, 29 Jul 2024 00:13:41 +0000 (20:13 -0400)]
set remote's annexUrl automatically
When the remote repository's git config file
has annex.url set to an annex+http url.
Joey Hess [Sun, 28 Jul 2024 21:29:32 +0000 (17:29 -0400)]
todo
Joey Hess [Sun, 28 Jul 2024 21:19:27 +0000 (17:19 -0400)]
documentation for p2phttp
Joey Hess [Sun, 28 Jul 2024 20:04:20 +0000 (16:04 -0400)]
avoid repeatedly parsing the proxy log
Joey Hess [Sun, 28 Jul 2024 19:55:24 +0000 (15:55 -0400)]
update
Joey Hess [Sun, 28 Jul 2024 19:41:31 +0000 (15:41 -0400)]
todo
Joey Hess [Sun, 28 Jul 2024 19:34:59 +0000 (15:34 -0400)]
fix hang in PUT of large file to a special remote node of a cluster over http
Joey Hess [Sun, 28 Jul 2024 19:11:31 +0000 (15:11 -0400)]
use closedv rather than separate endv
Doesn't fix any known problem, but this way if the connection does get
closed, it will notice.
Joey Hess [Sun, 28 Jul 2024 18:36:45 +0000 (14:36 -0400)]
remove temp file after upload to special remote
Joey Hess [Sun, 28 Jul 2024 18:24:15 +0000 (14:24 -0400)]
Merge remote-tracking branch 'origin/master' into httpproto
Joey Hess [Sun, 28 Jul 2024 18:22:44 +0000 (14:22 -0400)]
update
Joey Hess [Sun, 28 Jul 2024 18:15:28 +0000 (14:15 -0400)]
clean shut down of cluster connection when PUT is interrupted
An interrupted `git-annex copy --to` a cluster via the http server,
when repeated, failed. The http server output "transfer already in
progress, or unable to take transfer lock". Apparently a second
connection was opened to the cluster, because the first connection
never got shut down.
Turned out the problem was that when proxying to a cluster, it would read a
short ByteString from the client, and send that to the nodes. But that left the
nodes warning more. Meanwhile, the proxy was expecting a SUCCESS/FAILURE
message from the nodes. So it didn't return, and so the cluster connection
stayed open.
Joey Hess [Sun, 28 Jul 2024 17:31:30 +0000 (13:31 -0400)]
fix http proxying for a local git remote with a relative path
git-annex-shell expects an absolute path
Joey Hess [Sun, 28 Jul 2024 17:00:05 +0000 (13:00 -0400)]
found some bugs with clusters
Joey Hess [Sun, 28 Jul 2024 16:39:42 +0000 (12:39 -0400)]
clusters need enableInteractiveBranchAccess
As seen in commit
770aac97a75f64b86d73240055acffe1a5ed9f1a, a cluster
relies accurate location logs. If long-running processes are serving a
cluster, and one process puts a file, the other process needs to see
what nodes it was stored on when checking if the file is present.
Joey Hess [Sun, 28 Jul 2024 16:33:32 +0000 (12:33 -0400)]
smarter BranchState cache invalidation
Only invalidate a just-written file in the cache, not the whole cache.
This will avoid the possibly performance impact of cache invalidation
mentioned in commit
770aac97a75f64b86d73240055acffe1a5ed9f1a
Joey Hess [Sun, 28 Jul 2024 16:17:16 +0000 (12:17 -0400)]
share single BranchState amoung all threads
This fixes a problem when git-annex testremote is run against a cluster
accessed via the http server. Annex.Cluster uses the location log
to find nodes that contain a key when checking if the key is present or getting
it. Just after a key was stored to a cluster node, reading the location log
was not getting the UUID of that node.
Apparently the Annex action that wrote to the location log, and the one
that read from it were run with two different Annex states. The http server
does use several different Annex threads.
BranchState was part of the AnnexState, and so two threads could have
different BranchStates.
Moved BranchState to the AnnexRead, so all threads will see the common state.
This might possibly impact performance. If one thread is writing changes to the
branch, and another thread is reading from the branch, the writing thread will
now invalidate the BranchState's cache, which will cause the reading thread to
need to do extra work. But correctness is surely more important. If did is
found to have impacted performance, it could probably be dealt with by doing
smarter BranchState cache invalidation.
Another way this might impact performance is that the BranchState has a small
cache. If several threads were reading from the branch and relying on the value
they just read still being in the case, now a cache miss will be more likely.
Increasing the BranchState cache to the number of jobs might be a good
idea to amelorate that. But the cache is currently an innefficient list,
so making it large would need changes to the data types.
(Commit
4304f1b6aea19a5c402dc4f9d69aa4ff1c104c9b dealt with a follow-on
effect of the bug fixed here.)
Joey Hess [Sun, 28 Jul 2024 15:09:07 +0000 (11:09 -0400)]
better handling of content not available from cluster
Sending ERROR caused the client to get confused and protocol to freeze.
Better to send empty DATA and indicate it's not valid.
This fixes a hang in git-annex testremote of a cluster accessed via the
http server. That testremote is still failing, for some reason after
storing a test key, the cluster reports it as not present.
Joey Hess [Sun, 28 Jul 2024 14:36:22 +0000 (10:36 -0400)]
add --clusterjobs option and default to 1
The default of 1 is not ideal at all, but it avoids an accidental M*N
causing so much concurrency it becomes unusable.
Joey Hess [Sun, 28 Jul 2024 14:16:35 +0000 (10:16 -0400)]
cluster support in http API server
Wired it up and it seems to basically work, although the test suite is
not fully passing.
Note that --jobs currently gets multiplied by the number of nodes in the
cluster, which is probably not good.
Joey Hess [Sun, 28 Jul 2024 13:35:09 +0000 (09:35 -0400)]
remove duplicate code
Joey Hess [Sun, 28 Jul 2024 13:17:47 +0000 (09:17 -0400)]
tested shutdown of connection to http proxied special remote
I had worried it might not work properly, but it does, the endv works.
Joey Hess [Sun, 28 Jul 2024 13:14:42 +0000 (09:14 -0400)]
fix PUT to http proxied special remote
It was hanging because it never sent FAILURE in the INVALID case.
And putoffset always triggers the INVALID case.
Joey Hess [Sat, 27 Jul 2024 23:59:54 +0000 (19:59 -0400)]
thoughts on exporttree
Joey Hess [Sat, 27 Jul 2024 00:44:01 +0000 (20:44 -0400)]
update
Joey Hess [Sat, 27 Jul 2024 00:37:38 +0000 (20:37 -0400)]
UNLOCKCONTENT is not a top-level request
proxyRequest was treating UNLOCKCONTENT as a separate request.
That made it possible for there to be two different connections to the
proxied remote, with LOCKCONTENT being sent to one, and UNLOCKCONTENT
to the other one. A protocol error.
git-annex testremote now passes against a http proxied remote.
Joey Hess [Fri, 26 Jul 2024 23:50:15 +0000 (19:50 -0400)]
fix hang at end of PUT to proxied p2p http remote
sendExactly will now be sure to evaluate the whole lazy ByteString.
In this case, the lazy ByteString was exactly the right lenth.
But, it seems that L.take caused it to not actually be fully evaluated.
In servePut, this manifested as gather never being fully evaluated,
which caused the hang.
Very, very subtle, and horrible bug. Clearly the use of lazy ByteString
(or really just laziness) is at fault, and it would be very worth moving
to conduit or whatever to avoid this.
Joey Hess [Fri, 26 Jul 2024 21:15:09 +0000 (17:15 -0400)]
update
Joey Hess [Fri, 26 Jul 2024 20:34:08 +0000 (16:34 -0400)]
implement proxy connection pool
removeOldestProxyConnectionPool will be innefficient the larger the pool
is. A better data structure could be more efficient. Eg, make each value
in the pool include the timestamp of its oldest element, then the oldest
value can be found and modified, rather than rebuilding the whole Map.
But, for pools of a few hundred items, this should be fine. It's O(n*n log n)
or so.
Also, when more than 1 connection with the same pool key exists,
it's efficient even for larger pools, since removeOldestProxyConnectionPool
is not needed.
The default of 1 idle connection could perhaps be larger.. like the
number of jobs? Otoh, it seems good to ramp up and down the number of
connections, which does happen. With 1, there is at most one stale
connection, which might cause a request to fail.
yarikoptic [Fri, 26 Jul 2024 20:01:23 +0000 (20:01 +0000)]
initial report on keeping association with the remote
Joey Hess [Fri, 26 Jul 2024 19:50:01 +0000 (15:50 -0400)]
closeP2PConnection on interrupted GET
Joey Hess [Fri, 26 Jul 2024 19:25:15 +0000 (15:25 -0400)]
clean up after http p2p proxy GET is interrupted
There was an annex worker thread that did not get stopped.
It was stuck in ReceiveMessage from the P2PHandleTMVar.
Fixed by making P2PHandleTMVar closeable.
In serveGet, releaseP2PConnection has to come first, else the
annexworker may not shut down, if it's waiting to read from it.
In proxyConnection, call closeRemoteSide in order to wait for the ssh
process (for example).
Joey Hess [Fri, 26 Jul 2024 17:57:28 +0000 (13:57 -0400)]
close proxy remote side when done with it
Joey Hess [Fri, 26 Jul 2024 17:55:14 +0000 (13:55 -0400)]
oops
Joey Hess [Fri, 26 Jul 2024 17:54:37 +0000 (13:54 -0400)]
oops
Joey Hess [Fri, 26 Jul 2024 17:39:43 +0000 (13:39 -0400)]
clean up protocol version for proxying
The proxy always checks the protocol version of a remote before talking
to it in a version-specific way, so the protocol version in the ProxyParams
is the client's protocol version. The remote will always be at the same or
an older protocol version than the client.
Note that in relayDATAFinish, when the client is at protocol version 0,
the remote must thus be as well, and that's why its version is not
checked in the case for that.
With that clarified, it's evident that, in P2P.Http.State, there's no
need to look at the proxied remote's protocol version at all.
Joey Hess [Fri, 26 Jul 2024 17:24:56 +0000 (13:24 -0400)]
fix setting protocol version for v0 server
Before it was leaving the protocol version at the default, when it
was actually v0.
v0 has only ever been used over tor, which is probably why this bug was
never noticed.
Joey Hess [Fri, 26 Jul 2024 16:49:06 +0000 (12:49 -0400)]
fix hang in GET from http p2p proxy
serverP2PConnection = proxyfromclientconn causes serveGet to
signalFullyConsumedByteString to it, which is what it's waiting for
Joey Hess [Fri, 26 Jul 2024 16:48:47 +0000 (12:48 -0400)]
improve comment
Joey Hess [Fri, 26 Jul 2024 15:01:45 +0000 (11:01 -0400)]
update
Joey Hess [Fri, 26 Jul 2024 14:24:23 +0000 (10:24 -0400)]
http p2p proxy is now largely working
m.risse@77eac2c22d673d5f10305c0bade738ad74055f92 [Fri, 26 Jul 2024 11:42:49 +0000 (11:42 +0000)]
Added a comment
Joey Hess [Fri, 26 Jul 2024 01:36:10 +0000 (21:36 -0400)]
remove some debugging
Joey Hess [Thu, 25 Jul 2024 19:39:57 +0000 (15:39 -0400)]
wip
Joey Hess [Thu, 25 Jul 2024 19:18:06 +0000 (15:18 -0400)]
use a record to reduce the huge number of parameters
Joey Hess [Thu, 25 Jul 2024 19:00:36 +0000 (15:00 -0400)]
factored out proxyRequest
This will allow the HTTP server to keep a connection to a proxied
remote open, and only enter the Annex monad when handling a client
request.
Joey Hess [Thu, 25 Jul 2024 17:15:05 +0000 (13:15 -0400)]
http server support for proxies, incomplete
Refactored git-annex-shell code so this can use checkCanProxy'.
At this point all that remains is opening a proxy connection,
and using a proxy connection.
Joey Hess [Thu, 25 Jul 2024 16:00:57 +0000 (12:00 -0400)]
use annex+http for accessing proxies
Doesn't work yet on the http server side, which is throwing 502 bad
gateway.
Joey Hess [Thu, 25 Jul 2024 14:12:59 +0000 (10:12 -0400)]
less indent
Joey Hess [Thu, 25 Jul 2024 14:11:09 +0000 (10:11 -0400)]
p2phttp drop supports checking proof timestamps
At this point the p2phttp implementation is fully complete!
Joey Hess [Thu, 25 Jul 2024 00:55:58 +0000 (20:55 -0400)]
add common parameters to generic get API
Honestly this was just done to make the documentation correct. There's
no point in using these parameters. And they're optional.
Joey Hess [Wed, 24 Jul 2024 19:12:16 +0000 (15:12 -0400)]
fix build without servant
Joey Hess [Wed, 24 Jul 2024 18:36:37 +0000 (14:36 -0400)]
testremote passes on p2phttp remote
Joey Hess [Wed, 24 Jul 2024 18:25:40 +0000 (14:25 -0400)]
expire lock after 10 minutes initially
Once keeplocked is called, the lock will expire at the end
of that call. But if keeplocked never gets called, this avoids
the lock persisting forever.
Joey Hess [Wed, 24 Jul 2024 17:42:57 +0000 (13:42 -0400)]
Remote.Git lockContent works with annex+http urls
Joey Hess [Wed, 24 Jul 2024 16:33:26 +0000 (12:33 -0400)]
Remote.Git removeKey works with annex+http urls
Does not yet handle drop proof lock timestamp checking.
Joey Hess [Wed, 24 Jul 2024 16:19:53 +0000 (12:19 -0400)]
update
Joey Hess [Wed, 24 Jul 2024 16:18:51 +0000 (12:18 -0400)]
update
Joey Hess [Wed, 24 Jul 2024 16:14:56 +0000 (12:14 -0400)]
progress meter for p2phttp storeKey
Joey Hess [Wed, 24 Jul 2024 16:05:10 +0000 (12:05 -0400)]
Remote.Git storeKey works with annex+http urls
Does not yet update progress meter.
Joey Hess [Wed, 24 Jul 2024 15:13:37 +0000 (11:13 -0400)]
update
Joey Hess [Wed, 24 Jul 2024 15:10:19 +0000 (11:10 -0400)]
more generic clientGet
Joey Hess [Wed, 24 Jul 2024 15:03:59 +0000 (11:03 -0400)]
fix slowloris timeout in hashing resume of download of large file
Hash the data that is already present in the file before connecting to
the http server.
Joey Hess [Wed, 24 Jul 2024 14:28:48 +0000 (10:28 -0400)]
fix meter display on resume
It still needs to be offset, otherwise on resume from 80% it will
display 1%..20%.
Seems that this bug must have affected P2P.Annex as well where it runs
this code, but apparently it didn't affect it in a very user-visible
way. Maybe the transfer log file was updated incorrectly?
Joey Hess [Wed, 24 Jul 2024 13:45:14 +0000 (09:45 -0400)]
Remote.Git retrieveKeyFile works with annex+http urls
This includes a bugfix to serveGet, it hung at the end.
Joey Hess [Wed, 24 Jul 2024 13:08:17 +0000 (09:08 -0400)]
factor out resumeVerifyFromOffset
Joey Hess [Wed, 24 Jul 2024 12:33:59 +0000 (08:33 -0400)]
avoid needing ifdefs when using P2P.Http.Client
Joey Hess [Wed, 24 Jul 2024 01:17:06 +0000 (21:17 -0400)]
Merge branch 'master' into httpproto
Joey Hess [Wed, 24 Jul 2024 01:16:56 +0000 (21:16 -0400)]
Propagate --force to git-annex transferrer
And other child processes.
Joey Hess [Wed, 24 Jul 2024 01:02:31 +0000 (21:02 -0400)]
bug
Joey Hess [Tue, 23 Jul 2024 22:45:02 +0000 (18:45 -0400)]
cache credentials for p2phttp in memory
Joey Hess [Tue, 23 Jul 2024 22:21:01 +0000 (18:21 -0400)]
remove uuid from url when calling git credential
The user doesn't want to see a uuid in the prompt.
Also, when a http server is proxying, multiple remotes will have the
same base url, and the same password will work for them all.
Joey Hess [Tue, 23 Jul 2024 22:11:15 +0000 (18:11 -0400)]
use git credential when p2phttp needs auth
Joey Hess [Tue, 23 Jul 2024 19:37:36 +0000 (15:37 -0400)]
p2phttp support https
Joey Hess [Tue, 23 Jul 2024 19:19:56 +0000 (15:19 -0400)]
add --bind option and listen to both ipv4 and ipv6 by default
Joey Hess [Tue, 23 Jul 2024 18:58:49 +0000 (14:58 -0400)]
protocol version fallback on 404
and prettified errors
Joey Hess [Tue, 23 Jul 2024 18:31:32 +0000 (14:31 -0400)]
Remote.Git checkpresent works with annex+http urls.
Joey Hess [Tue, 23 Jul 2024 18:12:03 +0000 (14:12 -0400)]
factor out http server and client into own modules
To avoid a cycle when Remote.Git uses the client.
Joey Hess [Tue, 23 Jul 2024 17:53:10 +0000 (13:53 -0400)]
started wiring p2phttp into Remote.Git
but we have a cycle, ugh
Joey Hess [Tue, 23 Jul 2024 16:30:27 +0000 (12:30 -0400)]
require a valid uuid at the end of an annex+http url
Joey Hess [Tue, 23 Jul 2024 13:55:14 +0000 (09:55 -0400)]
add remoteAnnexP2PHttpUrl to RemoveGitConfig
This is always parsed, when building without servant, a Baseurl is not
generated, and users of it will need to fail.
Joey Hess [Tue, 23 Jul 2024 13:12:21 +0000 (09:12 -0400)]
starting support for remote.name.annexUrl set to annex+http
In this case, Remote.Git should not use that url for all access to
the repository. It will only be used for annex operations, which isn't
done yet.
Joey Hess [Tue, 23 Jul 2024 12:53:56 +0000 (08:53 -0400)]
update servant build flag
make it work when building w/o assistant
Joey Hess [Tue, 23 Jul 2024 12:53:52 +0000 (08:53 -0400)]
update
Joey Hess [Tue, 23 Jul 2024 12:42:33 +0000 (08:42 -0400)]
annex+http urls
Joey Hess [Tue, 23 Jul 2024 01:19:32 +0000 (21:19 -0400)]
refactor
Joey Hess [Tue, 23 Jul 2024 01:19:20 +0000 (21:19 -0400)]
fix build
Joey Hess [Tue, 23 Jul 2024 00:59:45 +0000 (20:59 -0400)]
update
Joey Hess [Tue, 23 Jul 2024 00:44:48 +0000 (20:44 -0400)]
change default port to 9417
Port 80 would need root, not a good idea, so pick something that might
work by default.
9418 is git protocol's port. 9419 is used by something, but nothing
known uses 9417, so it's as good a default as any.
Joey Hess [Tue, 23 Jul 2024 00:37:37 +0000 (20:37 -0400)]
exit cleanly on eg, failure to bind socket
Joey Hess [Mon, 22 Jul 2024 23:50:08 +0000 (19:50 -0400)]
P2P protocol is finalized
Joey Hess [Mon, 22 Jul 2024 23:48:54 +0000 (19:48 -0400)]
make keeplocked client UUID optional
It's not used, but it makes the protocol simpler if this parameter can
always be sent.
Joey Hess [Mon, 22 Jul 2024 23:44:26 +0000 (19:44 -0400)]
locking over http basically working
Joey Hess [Mon, 22 Jul 2024 23:15:52 +0000 (19:15 -0400)]
make serveKeepLocked check auth just to be safe
Joey Hess [Mon, 22 Jul 2024 22:55:12 +0000 (18:55 -0400)]
implement clientLockContent
Joey Hess [Mon, 22 Jul 2024 21:36:56 +0000 (17:36 -0400)]
implemented serveLockContent (untested)
Joey Hess [Mon, 22 Jul 2024 20:56:44 +0000 (16:56 -0400)]
improve clientKeepLocked