Skip to content

Handle storages not being available in webui and webdav - #9311

Merged
PVince81 merged 11 commits into
masterfrom
storage-not-available
Jul 2, 2014
Merged

PVince81 merged 11 commits into
masterfrom
storage-not-available

Conversation

@icewind1991

Copy link
Copy Markdown
Contributor

Adds \OCP\Files\StorageNotAvailableException which can be thrown by storage backends for when previously configured storage backends are (temporary) not available.

This exception is handled by both the web ui (show an error message) and WebDAV (throw a 503)

For #9088

cc @PVince81 @DeepDiver1975 @schiesbn

Comment thread apps/files/js/filelist.js

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will need to change all subclasses as well.

I'd prefer that you leave it as it was and use reloadCallback for now to avoid further regressions.
We can look into using your approach in OC 8.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the subclasses and the ones that need it do override reload() and reloadCallback() so the code you added won't have any effect there, which is fine.
We don't need that logic for the shared file list or mount point file list.

So you can ignore this comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did break: #9433 (comment)

@PVince81

Copy link
Copy Markdown
Contributor
  • storage not available (503): error message correctly shown
  • 403 forbidden (password changed): error message "Storage not available". Is fine for now.
  • 404 remote share deleted. FAIL: should remove the local mount

Let's discuss the 404 case: does it make sense to automatically remove the local mount when getting a 404 ? I can imagine that in some cases if the remote apache config has an issue that any URL would give a 404 as a temporary error. In such cases we might not want to remove the share.

Depending on the result of this, it might be acceptable to just show an error message.

  • fix JS code / clarify

@PVince81

Copy link
Copy Markdown
Contributor

For the 404 case: maybe there's a way to check whether the 404 is coming from ownCloud or from Apache. If it's from a running ownCloud, then it means the share is gone and should be removed.
Do we have any response headers we could use ?
I don't think we should ping the status.php as it would cause extra calls.

CC @schiesbn

@ghost

ghost commented Jun 30, 2014

Copy link
Copy Markdown

@schiessle

Copy link
Copy Markdown
Contributor

In case of a 404 we could send a second request to check if the ownCloud is accessible and running, maybe query the status.php or use the testremote ajax call?

If we get a 404 but the server is available we remove the mount, if not we keep it.

@icewind1991

Copy link
Copy Markdown
Contributor Author

Added additional checks to see why the remote share is unavailable, if it detects that the share is removed it now removes storage and throws an appropriate exception

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still reachable ? Is there a case where getShareInfo() will not throw an exception ? (just to clarify)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unlikely but not impossible so I kept it in

@PVince81

PVince81 commented Jul 1, 2014

Copy link
Copy Markdown
Contributor

@icewind1991 I hijacked your PR with a quickfix (for password testing). Hope it's ok 😄

@PVince81

PVince81 commented Jul 1, 2014

Copy link
Copy Markdown
Contributor

I went through the test steps again and it works.
Now I'll do the same with the sync client:

  • Test with WebDAV and error cases
  • Test with sync client and error cases

@PVince81

PVince81 commented Jul 1, 2014

Copy link
Copy Markdown
Contributor

Ideally the storage mount should disappear when I browse its parent, but that's again #5036 and possibly unefficient so let's leave it for now.

@PVince81

PVince81 commented Jul 1, 2014

Copy link
Copy Markdown
Contributor

There is an issue with the sync client, steps:

  1. Setup remote share "test" and mount it locally as "test"
  2. Setup sync client, wait for it to download "test"
  3. Unshare the remote share
  4. In the local folder, create a file inside "test"
  5. Wait for sync client to upload it

Instead of just saying 404 not found, the sync client asks for authentication.
It might be due to this:

{"reqId":"53b2d81c3d101","app":"webdav","message":"Sabre\\DAV\\Exception\\NotAuthenticated: Not authenticated","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #1 \/srv\/www\/htdocs\/owncloud\/lib\/private\/files\/storage\/dav.php(430): Sabre\\DAV\\Client->propFind('', Array)","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #2 \/srv\/www\/htdocs\/owncloud\/lib\/private\/files\/storage\/dav.php(417): OC\\Files\\Storage\\DAV->getPermissions('')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #3 \/srv\/www\/htdocs\/owncloud\/lib\/private\/files\/view.php(735): OC\\Files\\Storage\\DAV->isCreatable('')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #4 \/srv\/www\/htdocs\/owncloud\/lib\/private\/files\/view.php(255): OC\\Files\\View->basicOperation('isCreatable', '\/pub with space')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #5 \/srv\/www\/htdocs\/owncloud\/lib\/private\/connector\/sabre\/directory.php(67): OC\\Files\\View->isCreatable('\/pub with space')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #6 \/srv\/www\/htdocs\/owncloud\/3rdparty\/sabre\/dav\/lib\/Sabre\/DAV\/Server.php(1647): OC_Connector_Sabre_Directory->createFile('y', Resource id #263)","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #7 \/srv\/www\/htdocs\/owncloud\/3rdparty\/sabre\/dav\/lib\/Sabre\/DAV\/Server.php(900): Sabre\\DAV\\Server->createFile('pub with space\/...', Resource id #263, NULL)","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #8 [internal function]: Sabre\\DAV\\Server->httpPut('pub with space\/...')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #9 \/srv\/www\/htdocs\/owncloud\/3rdparty\/sabre\/dav\/lib\/Sabre\/DAV\/Server.php(474): call_user_func(Array, 'pub with space\/...')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #10 \/srv\/www\/htdocs\/owncloud\/3rdparty\/sabre\/dav\/lib\/Sabre\/DAV\/Server.php(214): Sabre\\DAV\\Server->invokeMethod('PUT', 'pub with space\/...')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #11 \/srv\/www\/htdocs\/owncloud\/apps\/files\/appinfo\/remote.php(61): Sabre\\DAV\\Server->exec()","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #12 \/srv\/www\/htdocs\/owncloud\/remote.php(52): require_once('\/srv\/www\/htdocs...')","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}
{"reqId":"53b2d81c3d101","app":"webdav","message":"Exception: #13 {main}","level":0,"time":"2014-07-01T15:47:40+00:00","method":"PUT","url":"\/owncloud\/remote.php\/webdav\/pub%20with%20space\/y"}

Please double check what is returned to the sync client when uploading to an expired remote share.

@ghost

ghost commented Jul 1, 2014

Copy link
Copy Markdown

@ghost

ghost commented Jul 1, 2014

Copy link
Copy Markdown

@DeepDiver1975

Copy link
Copy Markdown
Contributor

@icewind1991 failing unt test message:

Test_Files_Sharing_External_Storage::testStorageMountOptions with data set #0 ('http://remoteserver:8080/owncloud', 'http://remoteserver:8080/owncloud/public.php/webdav/')
Undefined index: manager

/var/lib/jenkins/jobs/pull-request-analyser/workspace@3/apps/files_sharing/lib/external/storage.php:48
/var/lib/jenkins/jobs/pull-request-analyser/workspace@3/apps/files_sharing/tests/externalstorage.php:76

@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@icewind1991

Copy link
Copy Markdown
Contributor Author

@PVince81 fixed WebDAV returning a 401 instead of a 404 when uploading something to an invalid share

@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

Another issue: I changed the password of the remote share and now the sync client says "Service not available". We probably need another error code for when the password has changed or when "Storage not available" is shown.

@dragotin @ogoffart is there any good error code for the sync client for when an ext storage is temporarily not available ? 503 doesn't seem to be adequate.

@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor
  • solve 503 issue with sync client when storage not available

@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

Also I found an annoying warning while testing, fix is here: #9362

@ogoffart

ogoffart commented Jul 2, 2014

Copy link
Copy Markdown

What should the client do in that case?
The error that is shown is directly the error reported by the server.
So you can send "503 Storage Temporarily not available" and the right error will be displayed on the client

@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

The problem at the moment is that the client seems to believe that the whole server is not available, the icon itself grays out. It also seems to stop syncing at this point but cannot confirm that.
Ideally it should still sync everything else.

@ogoffart

ogoffart commented Jul 2, 2014

Copy link
Copy Markdown

I see, this happens during the update phase.
Yes, the client cannot do "patial" sync yet.
503 seems like a good code for it, and we need to create a task for the client so that we can ignore some of the directories when syncing.

Currently for the client it's all of nothing.

@ghost

ghost commented Jul 2, 2014

Copy link
Copy Markdown

@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

Ok understood. I think the current behavior is not acceptable: that the client stops.
What if we return 403 or 404 ? I suppose that 404 would trigger local folder deletion.
Is that worse ?

@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

Note: I'm ok with merging this first if needed, we can fix the status code separately, but I think it needs to be addressed for OC 7 CE.

@schiessle

Copy link
Copy Markdown
Contributor

code looks good 👍

@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

👍 merging this now.

Will open a separate issue to handle the 503 issue.

PVince81 pushed a commit that referenced this pull request Jul 2, 2014
Handle storages not being available in webui and webdav
@PVince81
PVince81 merged commit f4eb90e into master Jul 2, 2014
@PVince81
PVince81 deleted the storage-not-available branch July 2, 2014 16:15
@PVince81

PVince81 commented Jul 2, 2014

Copy link
Copy Markdown
Contributor

Please follow up here for the 503 issue: #9376

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants