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

ndb: unexpected NDB blob Magic for pkg error #47

Closed
djoreilly opened this issue Nov 15, 2023 · 1 comment
Closed

ndb: unexpected NDB blob Magic for pkg error #47

djoreilly opened this issue Nov 15, 2023 · 1 comment

Comments

@djoreilly
Copy link
Contributor

On openSUSE Tumbleweed with the ndb backend. When zypper up runs and updates many packages there can be a lots of changes to the packages file. Attempting to use the library at the same time can fail with unexpected NDB blob Magic for pkg ...

Err: xerrors.Errorf("unexpected NDB blob Magic for pkg %d: %x", slot.PkgIndex, blobHeaderBuff.BlobMagic),

I think the rpm binary is using an exclusive file lock when updating the file
https://github.com/rpm-software-management/rpm/blob/rpm-4.17.0-release/lib/backend/ndb/rpmpkg.c

Adding a shared lock seems to fix the problem. I'll post a PR for review.

@djoreilly
Copy link
Contributor Author

Here are steps to reproduce:

  1. Run https://github.com/knqyf263/go-rpmdb/blob/master/cmd/rpmdb/main.go continuously until an error happens printing only stderr:
bash -e -c "cd /var/lib/rpm; while true; do ~/go-rpmdb/main >/dev/null; done"
  1. Run zypper up in another terminal. The more packages to be updated the more likely the problem will happen.

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

No branches or pull requests

1 participant