anatol / pacoloco

Caching proxy server for Arch Linux pacman
MIT License
199 stars 30 forks source link

Empty slice found error #88

Closed Focshole closed 11 months ago

Focshole commented 11 months ago

After inspecting the logs, I noticed an occasional error on a db file during prefetching. It happened occasionally since the 28th of may, always with the community.db file:

ago 01 03:00:04 testmachine pacoloco[727]: repo_db_mirror.go:234: An error occurred for mirror {/repo/archlinux/community/os/x86_64/community.db archlinux 2023-07-16 06:00:01.198244598 +0200 +0200} :empty slice found

The error is generated here https://github.com/anatol/pacoloco/blob/4995568b3e8a062efbee64a410b17b918a31dab0/repo_db_mirror.go#L234

But I suspect the error is being emitted here: https://github.com/anatol/pacoloco/blob/4995568b3e8a062efbee64a410b17b918a31dab0/repo_db_mirror.go#L210

GORM usually emits this error when some fields are missing I suppose. Maybe we should check that this array is not empty, as gorm may fail to save an empty array, but this is just guessing: https://github.com/anatol/pacoloco/blob/4995568b3e8a062efbee64a410b17b918a31dab0/repo_db_mirror.go#L205

anatol commented 11 months ago

The error is generated here

Could you post exact error message here?

You can change the code and see where exactly the error happens and whether it fixes the issue.

anatol commented 11 months ago

I believe it is a dup of #86

Focshole commented 11 months ago

The error is generated here

Could you post exact error message here?

You can change the code and see where exactly the error happens and whether it fixes the issue.

Oh sorry, I just noticed it was not visible!

Focshole commented 11 months ago

I believe it is a dup of #86

It is a different error which happens occasionally, I'll open a PR for the fix when I'll have some time to write it