Skip to content

lib/model: Don't close file early (fixes #6875) - #6876

Merged
calmh merged 1 commit into
syncthing:mainfrom
AudriusButkevicius:fix-close
Aug 3, 2020
Merged

calmh merged 1 commit into
syncthing:mainfrom
AudriusButkevicius:fix-close

Conversation

@AudriusButkevicius

Copy link
Copy Markdown
Member

I guess this might explain why this doesn't actually work.

@calmh
calmh merged commit 96e197e into syncthing:main Aug 3, 2020
@calmh

calmh commented Aug 3, 2020

Copy link
Copy Markdown
Member

Now I'm confused how there were positive user results on this.

@calmh

calmh commented Aug 3, 2020

Copy link
Copy Markdown
Member

So with this the fallback to standard works, but apparently none of my systems (macOS/APFS, FreeBSD/ZFS, Linux/ext4) support any of the fancy methods... (I added some debug prints) 🤷

@AudriusButkevicius

Copy link
Copy Markdown
Member Author

I'm surprised because sendfile should work.

If you run the tests for copy range stuff in fs package, does it also not work?

@AudriusButkevicius

Copy link
Copy Markdown
Member Author

Seems to fail for me as well. Looking.

@calmh

calmh commented Aug 3, 2020

Copy link
Copy Markdown
Member

The tests say PASS, only ioctl says SKIP. But that's also the case for the things that as I understand it should not pass...

@calmh

calmh commented Aug 3, 2020 •

Copy link
Copy Markdown
Member

On freebsd the ioctl and sendfile tests fail:

--- FAIL: TestCopyRange (0.57s)
    --- FAIL: TestCopyRange/ioctl (0.13s)
        --- FAIL: TestCopyRange/ioctl/append_to_end (0.02s)
        --- FAIL: TestCopyRange/ioctl/append_to_end,_offsets_at_start (0.02s)
        --- FAIL: TestCopyRange/ioctl/overwrite_part_of_destination_region (0.01s)
        --- FAIL: TestCopyRange/ioctl/overwrite_all_of_destination (0.01s)
        --- FAIL: TestCopyRange/ioctl/overwrite_part_of_destination (0.01s)
        --- FAIL: TestCopyRange/ioctl/destination_gets_expanded_as_it_is_being_written_to (0.01s)
        --- FAIL: TestCopyRange/ioctl/source_file_too_small (0.01s)
        --- FAIL: TestCopyRange/ioctl/not_block_aligned_write (0.01s)
        --- FAIL: TestCopyRange/ioctl/last_block (0.01s)
        --- FAIL: TestCopyRange/ioctl/whole_file_copy_block_aligned (0.01s)
        --- FAIL: TestCopyRange/ioctl/whole_file_copy_not_block_aligned (0.01s)
    --- FAIL: TestCopyRange/sendfile (0.12s)
        --- FAIL: TestCopyRange/sendfile/append_to_end (0.01s)
        --- FAIL: TestCopyRange/sendfile/append_to_end,_offsets_at_start (0.01s)
        --- FAIL: TestCopyRange/sendfile/overwrite_part_of_destination_region (0.01s)
        --- FAIL: TestCopyRange/sendfile/overwrite_all_of_destination (0.01s)
        --- FAIL: TestCopyRange/sendfile/overwrite_part_of_destination (0.01s)
        --- FAIL: TestCopyRange/sendfile/destination_gets_expanded_as_it_is_being_written_to (0.01s)
        --- FAIL: TestCopyRange/sendfile/source_file_too_small (0.01s)
        --- FAIL: TestCopyRange/sendfile/not_block_aligned_write (0.01s)
        --- FAIL: TestCopyRange/sendfile/last_block (0.01s)
        --- FAIL: TestCopyRange/sendfile/whole_file_copy_block_aligned (0.01s)
        --- FAIL: TestCopyRange/sendfile/whole_file_copy_not_block_aligned (0.01s)
    --- PASS: TestCopyRange/all (0.16s)
        --- PASS: TestCopyRange/all/append_to_end (0.02s)
        --- PASS: TestCopyRange/all/append_to_end,_offsets_at_start (0.02s)
        --- PASS: TestCopyRange/all/overwrite_part_of_destination_region (0.02s)
        --- PASS: TestCopyRange/all/overwrite_all_of_destination (0.02s)
        --- PASS: TestCopyRange/all/overwrite_part_of_destination (0.02s)
        --- PASS: TestCopyRange/all/destination_gets_expanded_as_it_is_being_written_to (0.02s)
        --- PASS: TestCopyRange/all/source_file_too_small (0.02s)
        --- PASS: TestCopyRange/all/not_block_aligned_write (0.01s)
        --- PASS: TestCopyRange/all/last_block (0.01s)
        --- PASS: TestCopyRange/all/whole_file_copy_block_aligned (0.01s)
        --- PASS: TestCopyRange/all/whole_file_copy_not_block_aligned (0.01s)
    --- PASS: TestCopyRange/standard (0.15s)
        --- PASS: TestCopyRange/standard/append_to_end (0.02s)
        --- PASS: TestCopyRange/standard/append_to_end,_offsets_at_start (0.02s)
        --- PASS: TestCopyRange/standard/overwrite_part_of_destination_region (0.02s)
        --- PASS: TestCopyRange/standard/overwrite_all_of_destination (0.02s)
        --- PASS: TestCopyRange/standard/overwrite_part_of_destination (0.02s)
        --- PASS: TestCopyRange/standard/destination_gets_expanded_as_it_is_being_written_to (0.02s)
        --- PASS: TestCopyRange/standard/source_file_too_small (0.02s)
        --- PASS: TestCopyRange/standard/not_block_aligned_write (0.01s)
        --- PASS: TestCopyRange/standard/last_block (0.01s)
        --- PASS: TestCopyRange/standard/whole_file_copy_block_aligned (0.01s)
        --- PASS: TestCopyRange/standard/whole_file_copy_not_block_aligned (0.01s)

On Mac they don't run, which I guess maybe should be the case for FreeBSD as well?

@calmh

calmh commented Aug 3, 2020

Copy link
Copy Markdown
Member

Maybe I should deploy a FreeBSD builder.

@AudriusButkevicius
AudriusButkevicius deleted the fix-close branch August 3, 2020 20:53
@AudriusButkevicius

Copy link
Copy Markdown
Member Author

So it seems it's the mtimefs that's getting in the way.

I also noticed golang/go#24331

Not sure we'd have any use for any of these cool poller features tho.

calmh added a commit that referenced this pull request Aug 7, 2020
* release:
  lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref #6875) (#6877)
  lib/model: Don't close file early (fixes #6875) (#6876)
@calmh calmh added this to the v1.9.0 milestone Aug 18, 2020
calmh added a commit to calmh/syncthing that referenced this pull request Aug 19, 2020
* main: (368 commits)
  build: We now target Go 1.14
  lib/fs: Disable ioctl on ppc (fixes syncthing#6898) (syncthing#6901)
  gui, man, authors: Update docs, translations, and contributors
  lib/dialer: Try dialing without reuse in parallel (fixes syncthing#6892) (syncthing#6893)
  cmd/stcrashreceiver: Don't crash on nil err
  all: Remove need to restart syncthing (syncthing#6883)
  lib/db: Don't put truncated files (ref syncthing#6855, ref syncthing#6501) (syncthing#6888)
  lib/osutil: Check returned error instead of info (ref syncthing#6885) (syncthing#6887)
  gui, man, authors: Update docs, translations, and contributors
  lib/osutil: Preserve perms in AtomicWriter (fixes #tbd) (syncthing#6885)
  lib/fs: Fix WatchRename test for FreeBSD (fixes syncthing#6613)
  lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref syncthing#6875) (syncthing#6877)
  lib/model: Don't close file early (fixes syncthing#6875) (syncthing#6876)
  lib/fs: Unwrap mtimeFile, get fd the "correct" way (ref syncthing#6875) (syncthing#6877)
  gui, man, authors: Update docs, translations, and contributors
  lib/fs: Fix WatchRename test for FreeBSD (fixes syncthing#6613)
  lib/model: Don't close file early (fixes syncthing#6875) (syncthing#6876)
  lib/db: Log context on panic (syncthing#6872)
  gui: Don't show pull order on SO folders (ref syncthing#6807) (syncthing#6871)
  lib/model: Check folder error before sync-waiting (fixes syncthing#6793) (syncthing#6847)
  ...
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Aug 4, 2021
@syncthing syncthing locked and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants