Skip to content

Conversation

@ap--
Copy link
Contributor

@ap-- ap-- commented May 3, 2024

Hi @martindurant

While working on the other PR I had a look at the smb tests and could reproduce the random failures locally. The failures that occurred were either connection failures (likely because the container wasn't up yet) or authentication errors.

I noticed, that every time the tests fail, SMBFileSystem._connect() which is called in __init__ errored 5 times, and was not able to register the session in smbclient.

I traced the authentication errors, and it turns out that, if _connect() fails to register a session initially, the later calls to smbclient in SMBFileSystem lack the username and password credentials because smbclient will fallback to a credential free session, if none is registered.

In this PR I just added a setting to be able to configure the number of retries for registering a session, and I set it to a very high number in the tests. With this fix, I am unable to reproduce failures locally.

It might be worth considering if _connect() should raise an explicit error if username is not None and the retries are exhausted. Because if I understand the smbclient behavior correctly, subsequent usage of smbclient in the methods of SMBFileSystem will then always raise an AuthenticationError.

@ap-- ap-- changed the title fsspec.implementations.smb: try harder to ensure session is registered Attempt to fix flaky smb tests May 3, 2024
@martindurant martindurant merged commit 8acde84 into fsspec:master May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants