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

The migration test server breaks rather frequently on resources ending with / #76

Closed
bourgeoa opened this issue Jan 21, 2025 · 5 comments · Fixed by #82
Closed

The migration test server breaks rather frequently on resources ending with / #76

bourgeoa opened this issue Jan 21, 2025 · 5 comments · Fixed by #82

Comments

@bourgeoa
Copy link
Member

see details here CommunitySolidServer/Recipes#45

The logs show 2 different issues on on locks and one on /
Could Pivot be responsible for the 7 one ?

@bourgeoa
Copy link
Member Author

@michielbdejong
It seems that with css@1.7.5 (latest) the server do not break, but the issue is still there.
It looks like resources returning 401 pivot is trying to reload adding a slash

2025-01-23T10:38:56.391Z [AuthorizingHttpHandler] {Primary} verbose: Available permissions are { http://bob.localhost:8080/settings/test.html: {} }
2025-01-23T10:38:56.391Z [PermissionBasedAuthorizer] {Primary} debug: Checking if {} has read permissions for http://bob.localhost:8080/settings/test.html
2025-01-23T10:38:56.391Z [PermissionBasedAuthorizer] {Primary} warn: Unauthenticated agent has no read permissions
2025-01-23T10:38:56.392Z [AuthorizingHttpHandler] {Primary} verbose: Authorization failed:
2025-01-23T10:38:56.392Z [SubdomainIdentifierStrategy] {Primary} debug: Identifier http://bob.localhost:8080/settings/test.html is part of http://localhost:8080/
2025-01-23T10:38:56.393Z [ChainedConverter] {Primary} debug: Converting internal/error -> application/json.
2025-01-23T10:38:56.394Z [SubdomainIdentifierStrategy] {Primary} debug: Identifier http://bob.localhost:8080/settings/test.html is part of http://localhost:8080/
2025-01-23T10:38:56.394Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://bob.localhost:8080/settings/test.html/
2025-01-23T10:38:56.394Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://bob.localhost:8080/settings/test.html/. 2 locks active.
2025-01-23T10:38:56.394Z [FileSystemResourceLocker] {Primary} debug: Acquiring lock for http://bob.localhost:8080/settings/test.html/
2025-01-23T10:38:56.394Z [MemoryResourceLocker] {Primary} debug: Released lock for http://bob.localhost:8080/settings/. 1 active locks remaining.
2025-01-23T10:38:56.395Z [MemoryResourceLocker] {Primary} debug: Released lock for http://bob.localhost:8080/settings/test.html/. 0 active locks remaining.
2025-01-23T10:38:56.395Z [SubdomainIdentifierStrategy] {Primary} debug: Identifier http://bob.localhost:8080/settings/test.html/ is part of http://localhost:8080/
2025-01-23T10:38:56.395Z [SubdomainExtensionBasedMapper] {Primary} debug: URL http://bob.localhost:8080/settings/test.html/ points to the container /mnt/d/github/pivot/data/bob/settings/test.html/
2025-01-23T10:38:56.396Z [MemoryResourceLocker] {Primary} debug: Acquiring lock for http://bob.localhost:8080/settings/test.html/
2025-01-23T10:38:56.396Z [MemoryResourceLocker] {Primary} debug: Acquired lock for http://bob.localhost:8080/settings/test.html/. 1 locks active.
2025-01-23T10:38:56.396Z [FileSystemResourceLocker] {Primary} debug: Releasing lock for http://bob.localhost:8080/settings/test.html/
2025-01-23T10:38:56.397Z [MemoryResourceLocker] {Primary} debug: Released lock for http://bob.localhost:8080/settings/test.html/. 0 active locks remaining.
[Error: ENOTDIR: not a directory, stat '/mnt/d/github/pivot/data/bob/settings/test.html/'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'stat',
  path: '/mnt/d/github/pivot/data/bob/settings/test.html/'
}

@bourgeoa
Copy link
Member Author

401 for /settings/test.html is wrong and should succeed with 200.
But that is a different issue
CommunitySolidServer/Recipes#43
CommunitySolidServer/Recipes#41

@michielbdejong
Copy link
Collaborator

michielbdejong commented Jan 23, 2025

Yes, that is what we wanted, right? If a URL is inaccessible and it has no slash, then Pivot redirects the user to that URL but with the slash. This was one of the first feature requests, see #4

We discussed doing it only if the container exists, but thought that that would be leaking information. So yes, if https://pod.com/foo is a 401, a 403, or a 404 for the user, then we redirect to https://pod.com/foo/

Is the behaviour not what we want? Maybe we only want to do it in case of a 404, for instance?

@bourgeoa
Copy link
Member Author

bourgeoa commented Jan 23, 2025

With the actual code the only solution is to only check for 404 status and check this is not a container

Personally I think we should have had something like.

If URL ends with('/') don't do anything => return
else if 404 try adding a '/' then
If 200 return URL + '/'
else return URL

The 200 may cover 2xx and may be 304 ???

This was referenced Jan 25, 2025
@michielbdejong
Copy link
Collaborator

I'm seeing errors in the log like this one:

[Error: ENOTDIR: not a directory, stat '/root/pivot/data/asdf/public/bookmarks.ttl/'] {
  errno: -20,
  code: 'ENOTDIR',
  syscall: 'stat',
  path: '/root/pivot/data/asdf/public/bookmarks.ttl/'
}

These probably come from the fact that there is no try-catch around this code. I'll see what happens when I add a try-catch there.

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

Successfully merging a pull request may close this issue.

2 participants