[GH-ISSUE #1507] Empty db after scanning #866

Closed
opened 2026-02-26 02:34:28 +03:00 by kerem · 12 comments
Owner

Originally created by @qstar-inc on GitHub (Sep 19, 2022).
Original GitHub issue: https://github.com/koel/koel/issues/1507

Describe the bug
After php artisan koel:sync completes successfully, it shows XX new files found on the CLI. But when I serve, there's nothing on the web UI. I've also checked the MySQL db and the tables are there, but it's all mostly empty. No songs, only unknown album/artist.

To reproduce
Steps to reproduce the behaviour:

  1. Execute php artisan koel:sync
  2. Wait for it to successfully complete
  3. Go to the web UI or mysql
  4. See nothing

Expected behaviour
Everything shows working; there's no error, but there's no result as well; nothing appears on site console or CLI as well to show anything isn't working.

Screenshots
image
image

Environment

  • Koel version v6.1.0
  • OS: Windows 10 x64
  • Browser: Firefox 105.0
  • PHP version 8.0.7
  • Node version v14.4.0

Additional context
Are there any other logs that I'm missing?

Originally created by @qstar-inc on GitHub (Sep 19, 2022). Original GitHub issue: https://github.com/koel/koel/issues/1507 **Describe the bug** After `php artisan koel:sync` completes successfully, it shows XX new files found on the CLI. But when I `serve`, there's nothing on the web UI. I've also checked the MySQL db and the tables are there, but it's all mostly empty. No songs, only unknown album/artist. **To reproduce** Steps to reproduce the behaviour: 1. Execute `php artisan koel:sync` 2. Wait for it to successfully complete 3. Go to the web UI or mysql 4. See nothing **Expected behaviour** Everything shows working; there's no error, but there's no result as well; nothing appears on site console or CLI as well to show anything isn't working. **Screenshots** ![image](https://user-images.githubusercontent.com/11435876/191024450-0b66f7a0-fe1f-44e6-8497-31234ae860db.png) ![image](https://user-images.githubusercontent.com/11435876/191024566-a4b67a78-7d5a-4d56-aedb-85f4ebc3a746.png) **Environment** - Koel version v6.1.0 - OS: Windows 10 x64 - Browser: Firefox 105.0 - PHP version 8.0.7 - Node version v14.4.0 **Additional context** Are there any other logs that I'm missing?
kerem closed this issue 2026-02-26 02:34:29 +03:00
Author
Owner

@phanan commented on GitHub (Sep 21, 2022):

Well, first thing first, Koel seems to have only seen 3 files during scanning according to your screen. I'd try syncing with -v flag and see what the problem is.

<!-- gh-comment-id:1253371986 --> @phanan commented on GitHub (Sep 21, 2022): Well, first thing first, Koel seems to have only seen 3 files during scanning according to your screen. I'd try syncing with `-v` flag and see what the problem is.
Author
Owner

@qstar-inc commented on GitHub (Sep 23, 2022):

Well, first thing first, Koel seems to have only seen 3 files during scanning according to your screen. I'd try syncing with -v flag and see what the problem is.

It was showing 3 because I've chosen just a small album with 3 tracks to test, since some of the files on the library was showing lib error with the artwork. It also happened with the whole library too. Regardless even that three should appear on the db.
I forgot to mention that I've already tried -v and it showed the full path of the file and OK; so no benefit with it.
image

<!-- gh-comment-id:1256597374 --> @qstar-inc commented on GitHub (Sep 23, 2022): > Well, first thing first, Koel seems to have only seen 3 files during scanning according to your screen. I'd try syncing with -v flag and see what the problem is. It was showing 3 because I've chosen just a small album with 3 tracks to test, since some of the files on the library was showing lib error with the artwork. It also happened with the whole library too. Regardless even that three should appear on the db. I forgot to mention that I've already tried `-v` and it showed the full path of the file and OK; so no benefit with it. ![image](https://user-images.githubusercontent.com/11435876/192043652-12fed410-9cec-4bf7-946b-588d3551df07.png)
Author
Owner

@phanan commented on GitHub (Sep 24, 2022):

Hmm that's very weird. What happens if you drag these files directly into the UI to upload them?

<!-- gh-comment-id:1256904986 --> @phanan commented on GitHub (Sep 24, 2022): Hmm that's very weird. What happens if you drag these files directly into the UI to upload them?
Author
Owner

@qstar-inc commented on GitHub (Sep 24, 2022):

I've tried uploading the files using drag and drop.
When I dragged folders, it said "No applicable files". So I went inside and tried two files one by one.
The progress showed successfully added. The files were also copied to a __KOEL_UPLOADS__ folder.
But they didn't appear on the All songs list or on the DB.
When it was starting, it took some time to load useUpload....js file so I went to retry.
After restarting koel, I tried two different songs. They did show success like before , files were copied to __KOEL_UPLOADS__ folder. And that new two songs appeared on the DB, but not on the All song list. But there were entries on the Artist page and I was even able to play them from there.
After restarting, the songs were still there. So I added the previous two too.
They were also there again after another restart.

Then I went ahead to do another sync with php artisan koel:sync -v; it showed 7 files found (3 original and 4 copied to upload folder). But on the UI again, all lists were empty as well as the database.

The database is clearly not read-only as it's able to write from the web UI, however when it syncs, it just cleans up the whole database.
I see there's an update, so I'm gonna try with the new update again.

<!-- gh-comment-id:1256914905 --> @qstar-inc commented on GitHub (Sep 24, 2022): I've tried uploading the files using drag and drop. When I dragged folders, it said "No applicable files". So I went inside and tried two files one by one. The progress showed successfully added. The files were also copied to a `__KOEL_UPLOADS__` folder. But they didn't appear on the All songs list or on the DB. When it was starting, it took some time to load `useUpload....js` file so I went to retry. After restarting koel, I tried two different songs. They did show success like before , files were copied to `__KOEL_UPLOADS__` folder. And that new two songs appeared on the DB, but not on the All song list. But there were entries on the Artist page and I was even able to play them from there. After restarting, the songs were still there. So I added the previous two too. They were also there again after another restart. Then I went ahead to do another sync with `php artisan koel:sync -v`; it showed 7 files found (3 original and 4 copied to upload folder). But on the UI again, all lists were empty as well as the database. The database is clearly not read-only as it's able to write from the web UI, however when it syncs, it just cleans up the whole database. I see there's an update, so I'm gonna try with the new update again.
Author
Owner

@aBuDeZ commented on GitHub (Nov 7, 2022):

Hello @qstar-inc , i have the same exact problem did you resolve it ?

<!-- gh-comment-id:1305495495 --> @aBuDeZ commented on GitHub (Nov 7, 2022): Hello @qstar-inc , i have the same exact problem did you resolve it ?
Author
Owner

@qstar-inc commented on GitHub (Nov 7, 2022):

Hello @qstar-inc , i have the same exact problem did you resolve it ?

Nope. Then again, I haven't tried since then.

<!-- gh-comment-id:1305500152 --> @qstar-inc commented on GitHub (Nov 7, 2022): > Hello @qstar-inc , i have the same exact problem did you resolve it ? Nope. Then again, I haven't tried since then.
Author
Owner

@aBuDeZ commented on GitHub (Nov 7, 2022):

Hello @qstar-inc , i have the same exact problem did you resolve it ?

Nope. Then again, I haven't tried since then.

Okay,appreciated for the quick reply, i will try and let you know if i find a solution.

<!-- gh-comment-id:1305506737 --> @aBuDeZ commented on GitHub (Nov 7, 2022): > > Hello @qstar-inc , i have the same exact problem did you resolve it ? > > Nope. Then again, I haven't tried since then. Okay,appreciated for the quick reply, i will try and let you know if i find a solution.
Author
Owner

@neov-98 commented on GitHub (Nov 26, 2022):

Hello, I have the same problem.

From additional information, I can inform you that it appears on my:

  • Windows 10 Pro v21H2 19044.1889.
  • Koel v6.7.5
  • Commit 37a1e568
  • OpenServer 5.3.9
    • PHP 8.0
    • MySQL 8.0
    • Nginx 1.21

I don't see such a problem on Linux.

I also noticed that at the time of scanning, it does not matter via the Web or the command line.
If the database is updated, rows are added one at a time and all are deleted at the end of the scan.
I can assume that the problem is at the final stage.

Therefore, the php artisan koel:sync -v request shows no problems.

At the same time, if I upload one song or several via the Web, then everything works fine.
But the rescan resets the entire table.

<!-- gh-comment-id:1328098520 --> @neov-98 commented on GitHub (Nov 26, 2022): Hello, I have the same problem. From additional information, I can inform you that it appears on my: - Windows 10 Pro v21H2 19044.1889. - Koel v6.7.5 - Commit 37a1e568 - OpenServer 5.3.9 - PHP 8.0 - MySQL 8.0 - Nginx 1.21 I don't see such a problem on Linux. I also noticed that at the time of scanning, it does not matter via the Web or the command line. If the database is updated, rows are added one at a time and all are deleted at the end of the scan. I can assume that the problem is at the final stage. Therefore, the `php artisan koel:sync -v` request shows no problems. At the same time, if I upload one song or several via the Web, then everything works fine. But the rescan resets the entire table.
Author
Owner

@phanan commented on GitHub (Nov 27, 2022):

If in /app/Listeners/DeleteNonExistingRecordsPostSync.php you replace the handle() method body with:

        $paths = $event->results
            ->valid()
            ->map(static fn (SyncResult $result) => $result->path)
            ->merge($this->songRepository->getAllHostedOnS3()->pluck('path'))
            ->toArray();

        \Log::info($paths);

        // the following line must be commented!
        // Song::deleteWhereValueNotIn($paths, 'path'); 

Run a scan, check the logged paths in storage/logs/laravel.log, and compare them with the songs table. What do you see?

<!-- gh-comment-id:1328273195 --> @phanan commented on GitHub (Nov 27, 2022): If in `/app/Listeners/DeleteNonExistingRecordsPostSync.php` you replace the `handle()` method body with: ```php $paths = $event->results ->valid() ->map(static fn (SyncResult $result) => $result->path) ->merge($this->songRepository->getAllHostedOnS3()->pluck('path')) ->toArray(); \Log::info($paths); // the following line must be commented! // Song::deleteWhereValueNotIn($paths, 'path'); ``` Run a scan, check the logged paths in `storage/logs/laravel.log`, and compare them with the `songs` table. What do you see?
Author
Owner

@neov-98 commented on GitHub (Nov 28, 2022):

Here is the output:

So everything is fine - the records are saved.
Apparently on Windows the problem is in backslashes

[2022-11-28 17:45:32] production.INFO: array (
  0 => 'E:\\OpenServer539\\Music\\IOWA - Mama.mp3',
  1 => 'E:\\OpenServer539\\Music\\yandex\\-babel-otnicka-remix.mp3',
  2 => 'E:\\OpenServer539\\Music\\yandex\\aleksha-novich-tihij-okean.mp3',
  3 => 'E:\\OpenServer539\\Music\\yandex\\dana-sokolova-razvedi-nebo-noyabr-2016.mp3',
  4 => 'E:\\OpenServer539\\Music\\yandex\\dj-hyper-clockwork-original-mix.mp3',
  5 => 'E:\\OpenServer539\\Music\\yandex\\else-paris-2016.mp3',
  6 => 'E:\\OpenServer539\\Music\\yandex\\escala-music-sweet-dreams-are-made-of-this.mp3',
  7 => 'E:\\OpenServer539\\Music\\yandex\\exclusive-music-mayhem-wyr-gemi.mp3',
  8 => 'E:\\OpenServer539\\Music\\yandex\\faneone-bre-petrunko-original-mix.mp3',
  9 => 'E:\\OpenServer539\\Music\\yandex\\FOLKBEAT - Синяя река.mp3',
  10 => 'E:\\OpenServer539\\Music\\yandex\\in-the-end-instrumental-linkin-park-cinematic-cover-produced-by-tommee-profitt.mp3',
  11 => 'E:\\OpenServer539\\Music\\yandex\\lindsey-stirling-love-goes-on-and-on-feat-amy-lee.mp3',
  12 => 'E:\\OpenServer539\\Music\\yandex\\lindsey_stirling_-_artemis.mp3',
  13 => 'E:\\OpenServer539\\Music\\yandex\\loungetronic-ready-or-not-nu-deep-mix.mp3',
  14 => 'E:\\OpenServer539\\Music\\yandex\\moses-emr3ygul-alexiane-a-million-on-my-soul-remix.mp3',
  15 => 'E:\\OpenServer539\\Music\\yandex\\para-dox-poslednee-slovo-procshaj-lyubimyj-poslednee-slovo-bylo-za-toboj.mp3',
  16 => 'E:\\OpenServer539\\Music\\yandex\\shena_-_dushno.mp3',
  17 => 'E:\\OpenServer539\\Music\\yandex\\wyr-gemi-predator.mp3',
  18 => 'E:\\OpenServer539\\Music\\yandex\\Канги - Жить Не Запретишь.mp3',
  19 => 'E:\\OpenServer539\\Music\\__KOEL_UPLOADS__\\aleksha-novich-tihij-okean.mp3',
  20 => 'E:\\OpenServer539\\Music\\__KOEL_UPLOADS__\\IOWA - Mama.mp3',
)  

image

<!-- gh-comment-id:1329502460 --> @neov-98 commented on GitHub (Nov 28, 2022): Here is the output: So everything is fine - the records are saved. Apparently on Windows the problem is in backslashes ``` [2022-11-28 17:45:32] production.INFO: array ( 0 => 'E:\\OpenServer539\\Music\\IOWA - Mama.mp3', 1 => 'E:\\OpenServer539\\Music\\yandex\\-babel-otnicka-remix.mp3', 2 => 'E:\\OpenServer539\\Music\\yandex\\aleksha-novich-tihij-okean.mp3', 3 => 'E:\\OpenServer539\\Music\\yandex\\dana-sokolova-razvedi-nebo-noyabr-2016.mp3', 4 => 'E:\\OpenServer539\\Music\\yandex\\dj-hyper-clockwork-original-mix.mp3', 5 => 'E:\\OpenServer539\\Music\\yandex\\else-paris-2016.mp3', 6 => 'E:\\OpenServer539\\Music\\yandex\\escala-music-sweet-dreams-are-made-of-this.mp3', 7 => 'E:\\OpenServer539\\Music\\yandex\\exclusive-music-mayhem-wyr-gemi.mp3', 8 => 'E:\\OpenServer539\\Music\\yandex\\faneone-bre-petrunko-original-mix.mp3', 9 => 'E:\\OpenServer539\\Music\\yandex\\FOLKBEAT - Синяя река.mp3', 10 => 'E:\\OpenServer539\\Music\\yandex\\in-the-end-instrumental-linkin-park-cinematic-cover-produced-by-tommee-profitt.mp3', 11 => 'E:\\OpenServer539\\Music\\yandex\\lindsey-stirling-love-goes-on-and-on-feat-amy-lee.mp3', 12 => 'E:\\OpenServer539\\Music\\yandex\\lindsey_stirling_-_artemis.mp3', 13 => 'E:\\OpenServer539\\Music\\yandex\\loungetronic-ready-or-not-nu-deep-mix.mp3', 14 => 'E:\\OpenServer539\\Music\\yandex\\moses-emr3ygul-alexiane-a-million-on-my-soul-remix.mp3', 15 => 'E:\\OpenServer539\\Music\\yandex\\para-dox-poslednee-slovo-procshaj-lyubimyj-poslednee-slovo-bylo-za-toboj.mp3', 16 => 'E:\\OpenServer539\\Music\\yandex\\shena_-_dushno.mp3', 17 => 'E:\\OpenServer539\\Music\\yandex\\wyr-gemi-predator.mp3', 18 => 'E:\\OpenServer539\\Music\\yandex\\Канги - Жить Не Запретишь.mp3', 19 => 'E:\\OpenServer539\\Music\\__KOEL_UPLOADS__\\aleksha-novich-tihij-okean.mp3', 20 => 'E:\\OpenServer539\\Music\\__KOEL_UPLOADS__\\IOWA - Mama.mp3', ) ``` ![image](https://user-images.githubusercontent.com/49375747/204347252-f0e799d3-b9db-4055-81b3-4210d9c5e727.png)
Author
Owner

@phanan commented on GitHub (Nov 28, 2022):

Ah, just like I suspected. Will try to issue a fix.

On Mon 28. Nov 2022 at 18:47 Вадим @.***> wrote:

Here is the output:

[2022-11-28 17:45:32] production.INFO: array (

0 => 'E:\OpenServer539\Music\IOWA - Mama.mp3',

1 => 'E:\OpenServer539\Music\yandex\-babel-otnicka-remix.mp3',

2 => 'E:\OpenServer539\Music\yandex\aleksha-novich-tihij-okean.mp3',

3 => 'E:\OpenServer539\Music\yandex\dana-sokolova-razvedi-nebo-noyabr-2016.mp3',

4 => 'E:\OpenServer539\Music\yandex\dj-hyper-clockwork-original-mix.mp3',

5 => 'E:\OpenServer539\Music\yandex\else-paris-2016.mp3',

6 => 'E:\OpenServer539\Music\yandex\escala-music-sweet-dreams-are-made-of-this.mp3',

7 => 'E:\OpenServer539\Music\yandex\exclusive-music-mayhem-wyr-gemi.mp3',

8 => 'E:\OpenServer539\Music\yandex\faneone-bre-petrunko-original-mix.mp3',

9 => 'E:\OpenServer539\Music\yandex\FOLKBEAT - Синяя река.mp3',

10 => 'E:\OpenServer539\Music\yandex\in-the-end-instrumental-linkin-park-cinematic-cover-produced-by-tommee-profitt.mp3',

11 => 'E:\OpenServer539\Music\yandex\lindsey-stirling-love-goes-on-and-on-feat-amy-lee.mp3',

12 => 'E:\OpenServer539\Music\yandex\lindsey_stirling_-_artemis.mp3',

13 => 'E:\OpenServer539\Music\yandex\loungetronic-ready-or-not-nu-deep-mix.mp3',

14 => 'E:\OpenServer539\Music\yandex\moses-emr3ygul-alexiane-a-million-on-my-soul-remix.mp3',

15 => 'E:\OpenServer539\Music\yandex\para-dox-poslednee-slovo-procshaj-lyubimyj-poslednee-slovo-bylo-za-toboj.mp3',

16 => 'E:\OpenServer539\Music\yandex\shena_-_dushno.mp3',

17 => 'E:\OpenServer539\Music\yandex\wyr-gemi-predator.mp3',

18 => 'E:\OpenServer539\Music\yandex\Канги - Жить Не Запретишь.mp3',

19 => 'E:\OpenServer539\Music\KOEL_UPLOADS\aleksha-novich-tihij-okean.mp3',

20 => 'E:\OpenServer539\Music\KOEL_UPLOADS\IOWA - Mama.mp3',

)


Reply to this email directly, view it on GitHub
https://github.com/koel/koel/issues/1507#issuecomment-1329502460, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AB5O3UTCFGKOPYH6ED4KPA3WKTV23ANCNFSM6AAAAAAQQC75VE
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:1329574919 --> @phanan commented on GitHub (Nov 28, 2022): Ah, just like I suspected. Will try to issue a fix. On Mon 28. Nov 2022 at 18:47 Вадим ***@***.***> wrote: > Here is the output: > > [2022-11-28 17:45:32] production.INFO: array ( > > 0 => 'E:\\OpenServer539\\Music\\IOWA - Mama.mp3', > > 1 => 'E:\\OpenServer539\\Music\\yandex\\-babel-otnicka-remix.mp3', > > 2 => 'E:\\OpenServer539\\Music\\yandex\\aleksha-novich-tihij-okean.mp3', > > 3 => 'E:\\OpenServer539\\Music\\yandex\\dana-sokolova-razvedi-nebo-noyabr-2016.mp3', > > 4 => 'E:\\OpenServer539\\Music\\yandex\\dj-hyper-clockwork-original-mix.mp3', > > 5 => 'E:\\OpenServer539\\Music\\yandex\\else-paris-2016.mp3', > > 6 => 'E:\\OpenServer539\\Music\\yandex\\escala-music-sweet-dreams-are-made-of-this.mp3', > > 7 => 'E:\\OpenServer539\\Music\\yandex\\exclusive-music-mayhem-wyr-gemi.mp3', > > 8 => 'E:\\OpenServer539\\Music\\yandex\\faneone-bre-petrunko-original-mix.mp3', > > 9 => 'E:\\OpenServer539\\Music\\yandex\\FOLKBEAT - Синяя река.mp3', > > 10 => 'E:\\OpenServer539\\Music\\yandex\\in-the-end-instrumental-linkin-park-cinematic-cover-produced-by-tommee-profitt.mp3', > > 11 => 'E:\\OpenServer539\\Music\\yandex\\lindsey-stirling-love-goes-on-and-on-feat-amy-lee.mp3', > > 12 => 'E:\\OpenServer539\\Music\\yandex\\lindsey_stirling_-_artemis.mp3', > > 13 => 'E:\\OpenServer539\\Music\\yandex\\loungetronic-ready-or-not-nu-deep-mix.mp3', > > 14 => 'E:\\OpenServer539\\Music\\yandex\\moses-emr3ygul-alexiane-a-million-on-my-soul-remix.mp3', > > 15 => 'E:\\OpenServer539\\Music\\yandex\\para-dox-poslednee-slovo-procshaj-lyubimyj-poslednee-slovo-bylo-za-toboj.mp3', > > 16 => 'E:\\OpenServer539\\Music\\yandex\\shena_-_dushno.mp3', > > 17 => 'E:\\OpenServer539\\Music\\yandex\\wyr-gemi-predator.mp3', > > 18 => 'E:\\OpenServer539\\Music\\yandex\\Канги - Жить Не Запретишь.mp3', > > 19 => 'E:\\OpenServer539\\Music\\__KOEL_UPLOADS__\\aleksha-novich-tihij-okean.mp3', > > 20 => 'E:\\OpenServer539\\Music\\__KOEL_UPLOADS__\\IOWA - Mama.mp3', > > ) > > > — > Reply to this email directly, view it on GitHub > <https://github.com/koel/koel/issues/1507#issuecomment-1329502460>, or > unsubscribe > <https://github.com/notifications/unsubscribe-auth/AB5O3UTCFGKOPYH6ED4KPA3WKTV23ANCNFSM6AAAAAAQQC75VE> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@phanan commented on GitHub (Nov 28, 2022):

@Vadim-vg Does #1605 fix the problem?

<!-- gh-comment-id:1329784334 --> @phanan commented on GitHub (Nov 28, 2022): @Vadim-vg Does #1605 fix the problem?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#866
No description provided.