Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A miss-unlocking bug #89

Open
ryancaicse opened this issue Apr 3, 2022 · 2 comments
Open

A miss-unlocking bug #89

ryancaicse opened this issue Apr 3, 2022 · 2 comments

Comments

@ryancaicse
Copy link

Hi, it seems lock best->mutex is missed to be released before line 815. Should it be a bug?

SZ/zstd/dictBuilder/cover.c

Lines 801 to 824 in c30cb79

ZSTD_pthread_mutex_lock(&best->mutex);
--best->liveJobs;
liveJobs = best->liveJobs;
/* If the new dictionary is better */
if (compressedSize < best->compressedSize) {
/* Allocate space if necessary */
if (!best->dict || best->dictSize < dictSize) {
if (best->dict) {
free(best->dict);
}
best->dict = malloc(dictSize);
if (!best->dict) {
best->compressedSize = ERROR(GENERIC);
best->dictSize = 0;
return;
}
}
/* Save the dictionary, parameters, and size */
memcpy(best->dict, dict, dictSize);
best->dictSize = dictSize;
best->parameters = parameters;
best->compressedSize = compressedSize;
}
ZSTD_pthread_mutex_unlock(&best->mutex);

@robertu94
Copy link
Collaborator

@ryancaicse this is a bundled version of Zstandard. We don’t really maintain it. Most people who use SZ will install it with a system or spack provided Zstandard rather than this one. If the upstream Zstandard has this same bug fixed, we can look into updating the bundled version

@ryancaicse
Copy link
Author

@robertu94 robertu94 mentioned this issue Apr 5, 2022
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 a pull request may close this issue.

2 participants