Comments (10)
Yes, this is about Windows, no problems for me on Linux.
With the debug logs it hangs reliably after receiving 4 times 128 bytes.
I'll try to work on it for a bit.
from git-credential-keepassxc.
Music to my ears :) I'll try getting a release out by this weekend.
I'll also bump the buffer size to 2048 or something, which is usually enough if you get 1 or 2 records per request. The buffer is atm on stack so being a tad frugal here :P
from git-credential-keepassxc.
I assume we are talking about Windows here?
I'm afraid I haven't got a proper local Windows environment and I don't use
KeePass 2 / KeePassNatMsg, so I'm not sure when / if I'll be able to look into
this problem myself. Though in the meanwhile, I added some debug logs [1] in
read_to_end
and I'm wondering if you can try it out [2]?
[1]
git-credential-keepassxc/src/utils.rs
Lines 266 to 272 in dd3b0b9
[2] https://github.com/Frederick888/git-credential-keepassxc/wiki/Troubleshooting#debug-logs
from git-credential-keepassxc.
I think I probably know the reason then.
Since these network-like streams haven't got an 'end' unless they are
closed, instead of returning 0 or error, read() just blocks when there's
no data.
This actually also impacts Linux. I tried setting BUF_SIZE to 1 [1] and
it started to block every time.
As a workaround, I added a timeout on these streams in [2] and confirmed
this fixed the issue on Linux using KeePassXC. The timeout is 200ms
which I think is appropriate for local streams, but it'd be nice if you
can test it out as well.
PS: It'll be even better if we can use logic like [3] to detect JSON
boundaries here, but it gets tricky due to these streams' duplex nature.
KeePassXC Browser can handle this since it's a long-running process.
Anyway, the workaround looks good enough to me atm.
[1]
git-credential-keepassxc/src/utils.rs
Line 262 in dd3b0b9
[2] https://github.com/Frederick888/git-credential-keepassxc/tree/read-timeout
[3]
git-credential-keepassxc/src/utils.rs
Lines 283 to 327 in dd3b0b9
from git-credential-keepassxc.
@pitdicker ping? :)
from git-credential-keepassxc.
Sorry for the slow reply! I learned a few things, but put off writing it down for too long (had to find back all the links...).
Named pipes on Windows apparently can not only be used as just a byte stream, but also in message mode. If the read buffer is not large enough, it will write part of the message and return ERROR_MORE_DATA
(link). But KeePassNatMsg explicitly sets up the pipe in byte mode. And KeePassXC uses QT's QlocalSocket
, which on first look only supports byte mode.
The difference between git-credential-helper and the browser proxies is the buffer size of 1024*1024 bytes (KeePassXC, keepassxc-proxy-rust, KeePassNatMsg).
Your solution of using a timeout to detect the end of a message makes the most sense to me, otherwise there is always some message size that gives problems. Would it be a good idea to also use the same buffer size?
from git-credential-keepassxc.
TIL Windows named pipes have 2 modes! Luckily the client I use supports
only bytes mode [1], so we are not wrong from the get-go, phew!
And I can certainly bump up the buffer size, but as you mentioned, that
may only make the issue happen less often (and more difficult to hunt
down!). So may I know if read-timeout
branch already solves your issue,
i.e. you can see Received 128 bytes: xxxx
and only 128 bytes
in
debug logs?
from git-credential-keepassxc.
By the way if you no longer have the KeePass record that you used to
produce the issue, you can also set BUF_SIZE
[1] to 1
to see if it
hangs.
[1]
git-credential-keepassxc/src/utils.rs
Line 267 in 970578e
from git-credential-keepassxc.
Just did a fresh test, the read-timeout
branch works perfectly!
from git-credential-keepassxc.
Realised that I had to removed the timeout and take the larger buffer
approach since the timeout breaks credential retrieval when the record
requires user approval (by clicking on Allow Selected in a pop-up
dialogue in KPXC).
v0.9.1 coming... lol
from git-credential-keepassxc.
Related Issues (20)
- Prompt to use Yubikey? HOT 3
- `dyld: Library not loaded: /usr/local/opt/libusb/lib/libusb-1.0.0.dylib` on macbook M1 HOT 1
- to add some docs for `git-credential-keepassxc get` command for non git use cases
- Support for error codes
- Support for error codes HOT 2
- Existing credentials used/updated! HOT 9
- Offer credentials from `Git` group only (CLI flag & automatically)
- KeePassXC update 2.7.2/2.7.3 breaks connection to Unix socket HOT 1
- Exit code of `ERRO ... is not allowed to call git-credential-keepassxc` is `0` HOT 2
- Notifications configurable via config file HOT 2
- Allow `get` to optionally receive one argument, and print only that field HOT 2
- [AUR package] shell is not allowed to call git-credential-keepassxc HOT 7
- What is the expected behavior when computer has multiple YubiKeys? HOT 3
- Filter by username to return nothing when no match HOT 2
- Readme unclear HOT 3
- Trouble Retrieving Password From Shell HOT 1
- Add support for git 2.41 HOT 2
- zsh is not allowed to call git-credential-keepassxc HOT 1
- Failed to locate socket, Caused by: N/A HOT 1
- Failed to connect to Unix socket HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from git-credential-keepassxc.