Now, I don't know much about golang, but one thing that might be related is that go-keyring checks whether err != nil, whereas wincred checks if cred != nil.
So I'd change the check from if err != nil to if cred == nil.
That wouldn't solve the underlying issue, but might convert the panic into a normal, handleable error.
Update:
I took a look at the logs, and, running on two different computers, I had two errors out of 290 runs (0.69%).
Each time it was executing a bunch of times successfully in sequence and then failed.
Ref https://github.com/danieljoos/wincred/issues/5#issuecomment-238009787, the CreadRead API seems to be a bit flakey, do you think it might make sense to check if cred, err are nil, nil, and then try a second time, or would that be better handled at the calling application (Kopia in this case)?
ref https://github.com/kopia/kopia/issues/732
I got a panic in Kopia, which uses go-keyring:
It crashes here in line 20: https://github.com/zalando/go-keyring/blob/6905df4fa6203334fbd683b7845b97ab68dd8e29/keyring_windows.go#L11-L20
Now, I don't know much about golang, but one thing that might be related is that go-keyring checks whether
err != nil
, whereas wincred checksif cred != nil
.In case
err
wasnil
andret
was0
here https://github.com/danieljoos/wincred/blob/78f93c1f8b99b0c2f6e7f3d2bdc4993cf87bddff/sys.go#L70, I believe that it would causenil, nil
to be returned.Another way
nil, nil
might be returned was ifcred
is null: https://github.com/danieljoos/wincred/blob/78f93c1f8b99b0c2f6e7f3d2bdc4993cf87bddff/conversion.go#L91-L94See https://github.com/danieljoos/wincred/issues/5#issuecomment-238009787.
So I'd change the check from
if err != nil
toif cred == nil
. That wouldn't solve the underlying issue, but might convert the panic into a normal, handleable error.Update:
I took a look at the logs, and, running on two different computers, I had two errors out of 290 runs (0.69%). Each time it was executing a bunch of times successfully in sequence and then failed.
Ref https://github.com/danieljoos/wincred/issues/5#issuecomment-238009787, the CreadRead API seems to be a bit flakey, do you think it might make sense to check if
cred, err
arenil, nil
, and then try a second time, or would that be better handled at the calling application (Kopia in this case)?Update 2:
4 failures in 439 runs (0.91%)