I am having the same issue as #230 except that I am running more than 2 threads. The failure is more likely the more threads I run in parallel. On my work system, it fails >50% of the time with 8 threads.
Here is my test code:
int thrd_proc(void *arg)
{
struct smb2_context* smb2;
smb2 = smb2_init_context();
if (smb2 == NULL)
{
printf("\n[%i] alloc fail", arg);
return -1;
}
smb2_set_domain(smb2, "ORG");
smb2_set_user(smb2, "user1");
smb2_set_password(smb2, "password1");
struct smb2_url* url = smb2_parse_url(smb2, "smb://files.org.tld/share$/mydir");
int res = smb2_connect_share(smb2, url->server, url->share, NULL);
if (res != 0)
{
printf("\n[%i] conn fail code %i: %s", arg, -res, smb2_get_error(smb2));
return -1;
}
struct smb2dir* dh = smb2_opendir(smb2, url->path);
if (dh == NULL)
{
printf("\n[%i] opendir fail", arg);
return -1;
}
struct smb2dirent* ent;
while ((ent = smb2_readdir(smb2, dh)) != NULL)
{
printf("\n[%i] %s", arg, ent->name);
}
smb2_closedir(smb2, dh);
res = smb2_disconnect_share(smb2);
printf("\n[%i] disc %i", arg, -res);
}
int main()
{
int thrd_count = 8;
thrd_t thrds[thrd_count];
for (int i = 0; i < thrd_count; ++i)
{
thrd_create(&thrds[i], thrd_proc, (void*) i);
printf("\nstart %i", i);
}
for (int i = 0; i < thrd_count; ++i)
{
thrd_join(thrds[i], NULL);
printf("\ndone %i", i);
}
}
Compiling the example with GCC and running, filtering to just errors, I can see output along the lines of:
❯ build-linux-gnu-x64/smb2test | grep "fail"
[6] conn fail code 22: Wrong signature in received PDU
[7] conn fail code 22: Wrong signature in received PDU
[3] conn fail code 22: Wrong signature in received PDU
I am having the same issue as #230 except that I am running more than 2 threads. The failure is more likely the more threads I run in parallel. On my work system, it fails >50% of the time with 8 threads.
Here is my test code:
Compiling the example with GCC and running, filtering to just errors, I can see output along the lines of: