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

Strange error when saving the tiddlywiki #3

Open
CGenie opened this issue Dec 6, 2021 · 16 comments
Open

Strange error when saving the tiddlywiki #3

CGenie opened this issue Dec 6, 2021 · 16 comments

Comments

@CGenie
Copy link

CGenie commented Dec 6, 2021

I can reproduce this on my android phone and on Chrome: when saving, I get "Error while saving: XMLHttpRequest error code: 423".
It seems however that the file is saved correctly.

@OutOfBrain
Copy link

Had the same happening to me. The file was corrupted afterwards though. Happened after (seemingly) too frequent saves (multiple within a couple of seconds).
Maybe a race condition on safe?

@qbit
Copy link
Owner

qbit commented Dec 6, 2021

Looks like TW is trying to modify the served wiki while another http request is happening (maybe a background save?).

@OutOfBrain are you also on android?

@AlexRamallo
Copy link

This happened to me today on iOS, and resulted in a corrupted wiki so it's just a blank page when you open it.

@qbit
Copy link
Owner

qbit commented Dec 6, 2021

I haven't been able to repro this. Can anyone offer more details on their usage? Perhaps install with -race enabled?

Do you have the wiki file open in multiple tabs?

@AlexRamallo
Copy link

I can reproduce it on my server. The error occurs when you have multiple overlapping PUT requests.

In my case, I'm running widdler I'm hosting a ~20mb wiki behind a reverse proxy. Save requests are pretty slow, so it's easy to accidentally send multiple.

@AlexRamallo
Copy link

Update and clarification: the overlapping saves are what cause the error message, but I haven't been able to get it to reliable corrupt the wiki with that alone.

However, if I start a save request on my phone, and then immediately close the browser or change tabs before the save completes, then it will corrupt 100% of the time. I'm guessing iOS interrupts xhr requests when a tab is in the background or something?

@qbit
Copy link
Owner

qbit commented Dec 6, 2021

Ok, I think I have a solution for the 423 issue but I think the corruption when saving is interrupted will be more involved.

qbit added a commit that referenced this issue Dec 9, 2021
Hopefully this helps with #3 (at least the HTTP 423 errors).
@qbit
Copy link
Owner

qbit commented Dec 9, 2021

Would anyone hitting the 423 issue be willing to try the muxd-handlers branch?

@CGenie
Copy link
Author

CGenie commented Dec 9, 2021

I'm not a go expert. I installed it with snap on Ubuntu (v. 1.17) and ran:

 go install suah.dev/widdler@muxd-handlers

but got this error:

go: downloading suah.dev/widdler v1.1.4-0.20211209124834-f9de42e80131
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/internal/xml/marshal.go:8:2: package bufio is not in GOROOT (/usr/lib/go/src/bufio)
../../../go/pkg/mod/golang.org/x/[email protected]/terminal.go:8:2: package bytes is not in GOROOT (/usr/lib/go/src/bytes)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/lock.go:8:2: package container/heap is not in GOROOT (/usr/lib/go/src/container/heap)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/file.go:8:2: package context is not in GOROOT (/usr/lib/go/src/context)
../../../go/pkg/mod/golang.org/x/[email protected]/bcrypt/bcrypt.go:11:2: package crypto/rand is not in GOROOT (/usr/lib/go/src/crypto/rand)
../../../go/pkg/mod/golang.org/x/[email protected]/bcrypt/bcrypt.go:12:2: package crypto/subtle is not in GOROOT (/usr/lib/go/src/crypto/subtle)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:4:2: package crypto/tls is not in GOROOT (/usr/lib/go/src/crypto/tls)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:5:2: package embed is not in GOROOT (/usr/lib/go/src/embed)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/internal/xml/marshal.go:10:2: package encoding is not in GOROOT (/usr/lib/go/src/encoding)
../../../go/pkg/mod/golang.org/x/[email protected]/bcrypt/base64.go:7:8: package encoding/base64 is not in GOROOT (/usr/lib/go/src/encoding/base64)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:15:2: package encoding/binary is not in GOROOT (/usr/lib/go/src/encoding/binary)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:6:2: package encoding/csv is not in GOROOT (/usr/lib/go/src/encoding/csv)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/file.go:9:2: package encoding/xml is not in GOROOT (/usr/lib/go/src/encoding/xml)
../../../go/pkg/mod/golang.org/x/[email protected]/bcrypt/bcrypt.go:13:2: package errors is not in GOROOT (/usr/lib/go/src/errors)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:7:2: package flag is not in GOROOT (/usr/lib/go/src/flag)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:8:2: package fmt is not in GOROOT (/usr/lib/go/src/fmt)
../../../go/pkg/mod/golang.org/x/[email protected]/bcrypt/bcrypt.go:15:2: package io is not in GOROOT (/usr/lib/go/src/io)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:9:2: package io/ioutil is not in GOROOT (/usr/lib/go/src/io/ioutil)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:10:2: package log is not in GOROOT (/usr/lib/go/src/log)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/affinity_linux.go:10:2: package math/bits is not in GOROOT (/usr/lib/go/src/math/bits)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/prop.go:14:2: package mime is not in GOROOT (/usr/lib/go/src/mime)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:11:2: package net is not in GOROOT (/usr/lib/go/src/net)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/file.go:11:2: package net/http is not in GOROOT (/usr/lib/go/src/net/http)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/webdav.go:13:2: package net/url is not in GOROOT (/usr/lib/go/src/net/url)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/file.go:12:2: package os is not in GOROOT (/usr/lib/go/src/os)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/file.go:13:2: package path is not in GOROOT (/usr/lib/go/src/path)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/file.go:14:2: package path/filepath is not in GOROOT (/usr/lib/go/src/path/filepath)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/internal/xml/marshal.go:13:2: package reflect is not in GOROOT (/usr/lib/go/src/reflect)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:16:2: package regexp is not in GOROOT (/usr/lib/go/src/regexp)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/ioctl.go:11:2: package runtime is not in GOROOT (/usr/lib/go/src/runtime)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:12:2: package sort is not in GOROOT (/usr/lib/go/src/sort)
../../../go/pkg/mod/golang.org/x/[email protected]/blowfish/cipher.go:19:8: package strconv is not in GOROOT (/usr/lib/go/src/strconv)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall.go:30:2: package strings is not in GOROOT (/usr/lib/go/src/strings)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:13:2: package sync is not in GOROOT (/usr/lib/go/src/sync)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/aliases.go:11:8: package syscall is not in GOROOT (/usr/lib/go/src/syscall)
../../../go/pkg/mod/suah.dev/[email protected]/main.go:19:2: package text/template is not in GOROOT (/usr/lib/go/src/text/template)
../../../go/pkg/mod/golang.org/x/[email protected]/unix/timestruct.go:10:8: package time is not in GOROOT (/usr/lib/go/src/time)
../../../go/pkg/mod/golang.org/x/[email protected]/webdav/internal/xml/xml.go:24:2: package unicode is not in GOROOT (/usr/lib/go/src/unicode)
../../../go/pkg/mod/golang.org/x/[email protected]/terminal.go:13:2: package unicode/utf8 is not in GOROOT (/usr/lib/go/src/unicode/utf8)
../../../go/pkg/mod/golang.org/x/[email protected]/internal/unsafeheader/unsafeheader.go:14:2: package unsafe is not in GOROOT (/usr/lib/go/src/unsafe)

@CGenie
Copy link
Author

CGenie commented Dec 9, 2021

Ah OK export GOROOT=/snap/go/8779 fixed this.

@CGenie
Copy link
Author

CGenie commented Dec 9, 2021

I still experience that error. Not on localhost, but I host widdler on a rock64 (arm) machine, maybe it's because of it's slowness that saving takes so long. I reproduce the error when making changes, then the red "save" button shows up (it's autosaving in the background I guess but it takes time), then I click that red "save" checkbox again and error shows up (on muxd-handlers as well).

@qbit
Copy link
Owner

qbit commented Dec 9, 2021

Ok, dang. I have been testing on localhost (loading a wiki up with a large number of images) - I'll try a remote install to see if I can repro

@CGenie
Copy link
Author

CGenie commented Dec 9, 2021 via email

@qbit
Copy link
Owner

qbit commented Dec 10, 2021

Alright, anyone wanna try 1.2.0? (go install suah.dev/widdler@latest)

I extended the locking a bit (shout out to diamondburned in #go-lang:matrix.org for the pointers!).

I still haven't been able to repro the 423 error. My vps is running OpenBSD.. maybe that has something to do with it - I will continue testing with a linux box and see what I get.

@AlexRamallo
Copy link

I just tested it and it seems like the error from overlapping requests is gone (the corruption issue still exists though)

To test locally, I used Firefox's network throttling feature (under the network tab in the dev tools). I sent overlapping save requests this way and didn't encounter the error from before. I also repeated it with version 1.1.3 to verify, and I did get the error in the older version.

On the 1.1.3 test I didn't get error 423 either, just an ajax error with error code 0. I wasn't able to reproduce the 423 error either.

@qbit
Copy link
Owner

qbit commented Dec 11, 2021

@AlexRamallo thanks for including the testing steps! I'll think more on the corruption.

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