-
Notifications
You must be signed in to change notification settings - Fork 32
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
panic from hashSearch #21
Comments
Thanks for your report. I haven’t used this project with changing files, so some rough edges are to be expected.
That commit has nothing to do with changing files, it was just a wrong calculation that manifested itself as files with certain file sizes never transferring correctly.
Not quite sure what you mean by this?
No, for the case of changing files, the buffer should be zeroed and the os.Exit should be removed. We don’t need to work around this issue, we need to fix the issue itself. In general, I’m not a fan of panic handlers in server programs. Instead of recovering panics, the only safe move upon a panic is to terminate the program. |
Hi @stapelberg thanks for your reply, fully understood. I am ok for not adding a panic handler. But how about changing the os.Exit(1) (which introduced by my previous change to the logger, and used by std log's fatal call) to panic? At least we can enable unit tests by using a panic. I will maintain a fork for my application for now. I will report back if I can see new reproduce for the issue I mentioned in the issue. |
We could write unit tests by using panic/recover, but again, I would prefer to return errors (which also enables testing, and in a more convenient way), or — in this particular case — just fix the issue itself, in which case there is no need to panic/recover :) |
Yep, but I am still finding it's hard to reproduce it yet. I managed to capture a reproduce last week. In my case, I can see: Lines 105 to 106 in f3bbd08
is returning |
It’s possible that you run into io.EOF if the file shrunk during transfer, but we don’t need to check for io.EOF explicitly — the existing conditional handles all error types, as it should. Should be relatively easy to reproduce using |
Hey,
Background
I am building an application that makes use of rsync as a file server to sync files to remote. In my implementation, it would potentially that the file contents changed during the file sync.
Issue & Symptom
I am seeing some random panics from the rsync call. Stack trace looks like this:
I can reproduce this issue from the commit: b567d9d . But I am not yet reproduce this issue in commits after this.
Unfortunately, I don't have a stable way to reproduce this issue (I am trying to automate the process, but no luck yet).
My guess
My guess is, this issue is due to in-flight file change + wrong read size settings (which fixed in this commit: f19f793). Could you confirm the fix commit f19f793 is for this behavior?
Further Asks
I checked the code, the
fileio.go
is doing some log trackings (which are commented out), and it also exit for unexpected data state:rsync/rsyncd/fileio.go
Lines 108 to 111 in f3bbd08
Is it possible to:
mapStruct
during theptr
call to capture the value ofoffset
, lastreadSize
/readOffset
etcos.Exit(1)
for these unexpected casesmapStruct.ptr
callWhat do you think?
The text was updated successfully, but these errors were encountered: