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

Moving a model from one library to another fails if libraries are on different devices #1937

Open
thibmaek opened this issue Mar 6, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@thibmaek
Copy link

thibmaek commented Mar 6, 2024

Describe the bug
A model added in one library that you edit and try to move into another existing library displays an application error

To Reproduce
Steps to reproduce the behavior:

  1. Open a model
  2. Edit it
  3. Change the library
  4. Application error

Expected behavior
The model moves succesfully between libraries in UI, database and folder structure

Screenshots

Screen.Recording.2024-03-06.at.13.03.35.mov

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Arc (Chromium)
  • Version: Latest

Additional context
The logs (docker compose logs -f) do not show any relevant info:

manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::DetectFilesystemChangesJob [a53f3fa0-99ed-4952-aac5-66b984b7d466] from DelayedJob(manyfold_production_default) with arguments: [1] (id=7) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::DetectFilesystemChangesJob [a53f3fa0-99ed-4952-aac5-66b984b7d466] from DelayedJob(manyfold_production_default) with arguments: [1] (id=7) (queue=manyfold_production_default) COMPLETED after 0.0611
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelScanJob [44503e55-a46c-4f70-bfe6-4a3a705efb65] from DelayedJob(manyfold_production_default) with arguments: [2] (id=8) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelScanJob [44503e55-a46c-4f70-bfe6-4a3a705efb65] from DelayedJob(manyfold_production_default) with arguments: [2] (id=8) (queue=manyfold_production_default) COMPLETED after 0.1430
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelFileScanJob [1e1b20e5-1881-43db-bc13-316db0b310b7] from DelayedJob(manyfold_production_default) with arguments: [2] (id=9) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelFileScanJob [1e1b20e5-1881-43db-bc13-316db0b310b7] from DelayedJob(manyfold_production_default) with arguments: [2] (id=9) (queue=manyfold_production_default) COMPLETED after 0.0249
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::AnalyseModelFileJob [f615d2cd-2fde-4048-9079-bda9b3d623ab] from DelayedJob(manyfold_production_scan) with arguments: [2] (id=10) (queue=manyfold_production_scan) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::AnalyseModelFileJob [f615d2cd-2fde-4048-9079-bda9b3d623ab] from DelayedJob(manyfold_production_scan) with arguments: [2] (id=10) (queue=manyfold_production_scan) COMPLETED after 0.0507
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] 4 jobs processed at 12.7329 j/s, 0 failed
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::DetectFilesystemChangesJob [325f64eb-8741-40a9-a4bb-2a1f818bd863] from DelayedJob(manyfold_production_default) with arguments: [2] (id=11) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::DetectFilesystemChangesJob [325f64eb-8741-40a9-a4bb-2a1f818bd863] from DelayedJob(manyfold_production_default) with arguments: [2] (id=11) (queue=manyfold_production_default) COMPLETED after 0.0613
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelScanJob [cbdb9a63-0c8b-450c-b2a4-ccb491c36eda] from DelayedJob(manyfold_production_default) with arguments: [3] (id=12) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelScanJob [cbdb9a63-0c8b-450c-b2a4-ccb491c36eda] from DelayedJob(manyfold_production_default) with arguments: [3] (id=12) (queue=manyfold_production_default) COMPLETED after 0.1588
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelFileScanJob [5a8ec253-4a3a-456a-a593-277a5cb64cc5] from DelayedJob(manyfold_production_default) with arguments: [3] (id=13) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelFileScanJob [5a8ec253-4a3a-456a-a593-277a5cb64cc5] from DelayedJob(manyfold_production_default) with arguments: [3] (id=13) (queue=manyfold_production_default) COMPLETED after 0.0258
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelFileScanJob [d58214e7-6dd3-40ab-acaf-a78bb0ccc8ca] from DelayedJob(manyfold_production_default) with arguments: [4] (id=14) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job ModelFileScanJob [d58214e7-6dd3-40ab-acaf-a78bb0ccc8ca] from DelayedJob(manyfold_production_default) with arguments: [4] (id=14) (queue=manyfold_production_default) COMPLETED after 0.0224
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::AnalyseModelFileJob [3c1c2e90-84cd-429a-bc10-94958b4022fc] from DelayedJob(manyfold_production_scan) with arguments: [3] (id=15) (queue=manyfold_production_scan) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::AnalyseModelFileJob [3c1c2e90-84cd-429a-bc10-94958b4022fc] from DelayedJob(manyfold_production_scan) with arguments: [3] (id=15) (queue=manyfold_production_scan) COMPLETED after 0.0447
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::AnalyseModelFileJob [71150f63-49a9-412c-a123-53b512ebda93] from DelayedJob(manyfold_production_scan) with arguments: [4] (id=16) (queue=manyfold_production_scan) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::AnalyseModelFileJob [71150f63-49a9-412c-a123-53b512ebda93] from DelayedJob(manyfold_production_scan) with arguments: [4] (id=16) (queue=manyfold_production_scan) COMPLETED after 0.0421
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] 6 jobs processed at 14.8544 j/s, 0 failed
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::DetectFilesystemChangesJob [a34c295c-e8a2-47c1-bf84-2e18d7032c10] from DelayedJob(manyfold_production_default) with arguments: [2] (id=17) (queue=manyfold_production_default) RUNNING
manyfold_app    | 08:52:39 worker.1 | [Worker(host:243236280e08 pid:40)] Job Scan::DetectFilesystemChangesJob [a34c295c-e8a2-47c1-bf84-2e18d7032c10] from DelayedJob(manyfold_production_default) with arguments: [2] (id=17) (queue=manyfold_production_default) COMPLETED after 0.1289
manyfold_db     | 2024-03-06 12:02:40.370 UTC [64] LOG:  checkpoint starting: time
manyfold_db     | 2024-03-06 12:02:41.807 UTC [64] LOG:  checkpoint complete: wrote 15 buffers (0.1%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.409 s, sync=0.011 s, total=1.438 s; sync files=15, longest=0.008 s, average=0.001 s; distance=1 kB, estimate=749 kB
@thibmaek thibmaek added the bug Something isn't working label Mar 6, 2024
@Floppy
Copy link
Collaborator

Floppy commented Mar 6, 2024

Thanks for reporting! I'll check this out immediately.

@Floppy
Copy link
Collaborator

Floppy commented Mar 6, 2024

Interesting, it works here in dev. I note that you're running v0.57.1? I released .2 yesterday with a few bug fixes; I don't think any of them are related to this, but could you update and give it a go? In the meantime, I'll carry on trying to replicate.

There may be relevant info in the logs tab of the Advanced Admin area, too.

@thibmaek
Copy link
Author

thibmaek commented Mar 6, 2024

Same deal when I try with .2 version. This is what I found in the logs:

I, [2024-03-06T13:29:19.724323 #91]  INFO -- : [fd67224a-5f34-4940-860e-ebebd2a39ce0] method=GET path=/libraries/2/models/4/edit format=html controller=ModelsController action=edit status=200 allocations=26246 duration=227.06 view=105.81 db=58.72
I, [2024-03-06T13:29:25.935285 #73]  INFO -- : [6073742d-c37b-4f82-acf8-aa04dba90485] method=PATCH path=/libraries/2/models/4 format=html controller=ModelsController action=update status=500 allocations=18663 duration=223.25 view=0.00 db=72.28
F, [2024-03-06T13:29:25.938301 #73] FATAL -- : [6073742d-c37b-4f82-acf8-aa04dba90485]   
[6073742d-c37b-4f82-acf8-aa04dba90485] Errno::EXDEV (Cross-device link @ rb_file_s_rename - (/libraries/inbox/Nest Mini Stand Model, /libraries/printed/Nest Mini Stand Model)):
[6073742d-c37b-4f82-acf8-aa04dba90485]   
[6073742d-c37b-4f82-acf8-aa04dba90485] app/models/model.rb:166:in `rename'
[6073742d-c37b-4f82-acf8-aa04dba90485] app/models/model.rb:166:in `move_files'
[6073742d-c37b-4f82-acf8-aa04dba90485] app/controllers/models_controller.rb:48:in `update'

My volumes are linked like this with Docker:

volumes:
  - /mnt/nas_data/3d-print/manyfold/inbox:/libraries/inbox
  - /mnt/nas_data/3d-print/manyfold/printed:/libraries/printed

@Floppy
Copy link
Collaborator

Floppy commented Mar 6, 2024

Whoa, Errno::EXDEV, that's a new one on me! Looking that up, it's because I'm using rename rather than move, and you can't do that across different disks. And because your two libraries are mapped separately, they come up as different devices. Nice edge case!

So, to solve it straight away, you could change your docker mapping so that both libraries are in the same volume - as they're both in the same place on your NAS you don't actually need to map them separately. You shouldn't need to make any changes inside Manyfold either as the paths will stay exactly the same.

volumes:
  - /mnt/nas_data/3d-print/manyfold:/libraries

Then in the longer term, I should change to move rather than rename, because having the different libraries on different devices is totally a valid thing to do!

@Floppy Floppy changed the title Moving a model from one library to another fails Moving a model from one library to another fails if libraries are on different devices Mar 6, 2024
@thibmaek
Copy link
Author

thibmaek commented Mar 9, 2024

Thanks this indeed worked by only mapping the volume once!

@thibmaek thibmaek closed this as completed Mar 9, 2024
@Floppy
Copy link
Collaborator

Floppy commented Mar 9, 2024

Gonna reopen this to remind me to make it handle the situation properly; glad you got it working!

@Floppy Floppy reopened this Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants