cryptomator / webdav-nio-adapter

Jackrabbit-based servlets running on embedded Jetty to serve a directory specified by a java.nio.file.Path
GNU Affero General Public License v3.0
12 stars 8 forks source link

Error when mounting with LinuxGioMounter: `Message is already in session queue` #45

Open overheadhunter opened 1 year ago

overheadhunter commented 1 year ago

LinuxGioMounter fails to mount in some cases:

java.io.IOException: Command failed with exit code 2. Expected 0.
    at org.cryptomator.frontend.webdav@2.0.0-beta4/org.cryptomator.frontend.webdav.mount.ProcessUtil.assertExitValue(ProcessUtil.java:25)
    at org.cryptomator.frontend.webdav@2.0.0-beta4/org.cryptomator.frontend.webdav.mount.LinuxGioMounter$MountBuilderImpl.mount(LinuxGioMounter.java:97)
    ... 13 more
Caused by: java.io.IOException: Stderr output: gio: dav://localhost:42427/lsLoxEBKL0GZ: Message is already in session queue
    at org.cryptomator.frontend.webdav@2.0.0-beta4/org.cryptomator.frontend.webdav.mount.ProcessUtil.assertExitValue(ProcessUtil.java:23)

@infeo found this possibly related upstream bug in gvfs: https://gitlab.gnome.org/GNOME/gvfs/-/issues/630. Looks like a trailing slash in the URL may make the difference. However I am not sure, this really changed:

With webdav-nio-adapter version 1.2.8 (Cryptomator 1.6.17) this was the implementation:

https://github.com/cryptomator/webdav-nio-adapter/blob/b69f45d027a1d5ee56e601a685a6ce19ad459af5/src/main/java/org/cryptomator/frontend/webdav/mount/LinuxGioMounter.java#L41-L42

With webdav-nio-adapter version 2.0.0 (Cryptomator 1.7.0) it doesn't look any different:

https://github.com/cryptomator/webdav-nio-adapter/blob/6feec9f1ab49cf8cf33b02f8d5c7b6b48d5533d5/src/main/java/org/cryptomator/frontend/webdav/mount/LinuxGioMounter.java#L91-L94

overheadhunter commented 1 year ago

In 1.2.8, we constructed the URI with an injected @ContextPath String contextPath, from which we explicitly removed the trailing slash:

https://github.com/cryptomator/webdav-nio-adapter/blob/8e5b1dff3b2787e0e44b4ff2ead34a1bd2fff40a/src/main/java/org/cryptomator/frontend/webdav/servlet/WebDavServletModule.java#L42-L46

In 2.0.0 there is no Dagger any longer. But the normalizedContextPath() that we pass to the servlet is still not having any trailing slash:

https://github.com/cryptomator/webdav-nio-adapter/blob/6feec9f1ab49cf8cf33b02f8d5c7b6b48d5533d5/src/main/java/org/cryptomator/frontend/webdav/mount/AbstractMountBuilder.java#L58-L64