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

renaming of files/folders shows an error in phoenix #450

Closed
individual-it opened this issue Aug 13, 2020 · 15 comments
Closed

renaming of files/folders shows an error in phoenix #450

individual-it opened this issue Aug 13, 2020 · 15 comments
Assignees

Comments

@individual-it
Copy link
Member

  1. checkout Update deps 2020 07 22 #409
  2. start ocis with bin/ocis server
  3. start a redis server docker run --rm -e REDIS_DATABASES=1 -p 6379:6379 -d webhippie/redis:latest
  4. login to phoenix
  5. upload a file
  6. try to rename the file

file is renamed but the popup does not disappear and an error is shown saying that there was an error renaming
rename

Phoenix sends two MOVE requests, one is successful the second one received a 500 response

OCIS log:

2020-08-13T08:45:35+05:45 ERR home/artur/go/pkg/mod/github.com/cs3org/reva@v1.1.0/internal/grpc/services/storageprovider/storageprovider.go:439 > error moving file error="ocfs: error moving /var/tmp/reva/data/4c510ada-c86b-4815-8820-42cdf82c3d51/files/settings.txt to /var/tmp/reva/data/4c510ada-c86b-4815-8820-42cdf82c3d51/files/renamed.txt: rename /var/tmp/reva/data/4c510ada-c86b-4815-8820-42cdf82c3d51/files/settings.txt /var/tmp/reva/data/4c510ada-c86b-4815-8820-42cdf82c3d51/files/renamed.txt: no such file or directory" pkg=rgrpc service=reva traceid=a4d196337cd4c1ba8ed3f896af2db67b
@individual-it individual-it changed the title renaming of files/folders does not work renaming of files/folders shows an error in phoenix Aug 13, 2020
@kulmann kulmann mentioned this issue Aug 13, 2020
63 tasks
@PVince81
Copy link
Contributor

strange that this test didn't fail in Phoenix + OC 10.

maybe if the second response is 404 instead of 500 then this goes unnoticed.

we need to fix two things:

  • ocis must return 404 when moving a non-existing resource @refs
  • prevent double sending of move
  • check if copy affected as well

@PVince81
Copy link
Contributor

okay, so if I run ocis alone with its bundled assets, I see the error.

however if I use the Phoenix repo's assets, no error on renaming.

@PVince81
Copy link
Contributor

After clearing my phoenix env and reinstalling libs, the bug is now reproduceab.e

so it's likely that some lib update is now triggering that double send

@PVince81
Copy link
Contributor

okay, I managed to reproduce the issue:
First: yarn run clean-all && yarn run install-all && yarn run build-all
then add log statements and run yarn run build-all

Using watch commands seem to make the bug disappear, maybe because the code is not minified the same way...

When renaming, I see this after adding log statements:
image

@refs refs self-assigned this Aug 13, 2020
@PVince81
Copy link
Contributor

even more logging:
image

this doesn't make any sense:
the method $_fileActions_renameResource is the only one that can call renameFile.
and yet, the former is called once but the second one twice...
as if VueJS or something internally decided to call the method twice

diff below to show where I logged:

diff --git a/apps/files/src/fileactions.js b/apps/files/src/fileactions.js
index 18249c59..2ab772f9 100644
--- a/apps/files/src/fileactions.js
+++ b/apps/files/src/fileactions.js
@@ -210,8 +210,10 @@ export default {
     },
 
     $_fileActions_renameResource(resource, newName) {
+      console.log('$_fileActions_renameResource', resource, newName)
       this.toggleModalConfirmButton()
 
+      console.log('Calling renameFile', resource, newName)
       this.renameFile({
         client: this.$client,
         file: resource,
@@ -219,6 +221,7 @@ export default {
         publicPage: this.publicPage()
       })
         .then(() => {
+          console.log('hideModal')
           this.hideModal()
         })
         .catch(error => {
diff --git a/apps/files/src/store/actions.js b/apps/files/src/store/actions.js
index cc6071a0..a72d7d83 100644
--- a/apps/files/src/store/actions.js
+++ b/apps/files/src/store/actions.js
@@ -648,6 +648,7 @@ export default {
     }
   },
   renameFile(context, { file, newValue, client, publicPage }) {
+    console.log('renameFile', context, file, newValue)
     if (file !== undefined && newValue !== undefined && newValue !== file.name) {
       const newPath = file.path.substr(1, file.path.lastIndexOf('/'))
       if (publicPage) {
diff --git a/src/store/modal.js b/src/store/modal.js
index d6556181..56bf8cd0 100644
--- a/src/store/modal.js
+++ b/src/store/modal.js
@@ -36,6 +36,7 @@ const actions = {
   },
 
   toggleModalConfirmButton({ commit }) {
+    console.log('toggleModelConfirmButton')
     commit('TOGGLE_MODAL_CONFIRM_BUTTON')
   }
 }

I'll see if I can fire up a debugger and see whether the framework is doing something weird

@PVince81
Copy link
Contributor

PVince81 commented Aug 13, 2020

if I build in dev mode with node build/run-for-all.js -p yarn run build && yarn build:dev (avoiding watch here), then the bug disappears... 😢

image

only one call ^

@PVince81
Copy link
Contributor

I debugged into the VueJS wrappers from mapActions and have observed that the "action subscribers" contain the renameFile function twice:
image

@refs refs closed this as completed Aug 13, 2020
@refs refs reopened this Aug 13, 2020
@refs
Copy link
Member

refs commented Aug 13, 2020

While testing I noticed:

image

The Markdown editor appearing twice. I'm not using local assets, instead using the compiled ones on ocis.

@kulmann
Copy link
Contributor

kulmann commented Aug 13, 2020

@refs is your session still open / can you reproduce? If yes, please check the js console, if there are errors about duplicate registered routes.

@PVince81
Copy link
Contributor

I'm now trying to bisect... now sitting on 604e8b5e which also has the issue

here's the log output in case it helps... I see no duplicate stuff there on init
image

@PVince81
Copy link
Contributor

the bug is reproducible also with Phoenix v0.13.0 compiled locally...

ocis beta8 which is the last stable release as using ocis-phoenix v0.9.0 which itself is based on Phoenix v0.12.0.

so I'll try v0.12.0 next and hope the bug disappears....

@PVince81
Copy link
Contributor

the bug also appears with v0.12.0... at this stage it doesn't make sense because Phoenix was stable back with ocis beta8.

so the problem might be either in the setup or on ocis branch #409.

I'll now try the same procedure but with ocis beta8 and then ocis master.

@PVince81
Copy link
Contributor

with ocis master 79f8e7e it works fine!!

next up: bisecting into #409

@PVince81
Copy link
Contributor

apparently 57f4953 in #409 fixes the issue.

with the previous commits I get the error.

but also, I started ocis-debug with this command so I don't think that ocis-phoenix should have any effect:
PHOENIX_ASSET_PATH=~/work/workspace/phoenix/dist PHOENIX_WEB_CONFIG=~/work/workspace/phoenix/config-ocis.json OCIS_LOG_LEVEL=debug bin/ocis-debug --log-level=debug server > /var/tmp/ocis/ocis.log 2>&1

so maybe there's another bug hidden there...

@kulmann
Copy link
Contributor

kulmann commented Aug 14, 2020

Turned out that this was due to broken assets in an ocis-phoenix PR that we pinned in #409

We addressed faulty loading of phoenix assets in a separate PR.

@kulmann kulmann closed this as completed Aug 14, 2020
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

4 participants