Skip to content

Mongodb fdatasync wrong in 20H1 #5207

Closed

Description

@riggzh
  • Your Windows build number:
Microsoft Windows [Version 10.0.19041.264]
  • What you're doing and what's happening:
When start mongodb service
Mongodb service install from Ubuntu apt both 18.04 and 20.04[hole libc6 old version fix sleep]
  • What's wrong / what should be happening instead:
It's work in 19H2 [18363.778] (both test lxfs and wslfs)
And change data path to /dev/data (I mkdir empty) also work
  • Strace of the failing command, if applicable:
2020-05-13T16:02:24.948+0800 I CONTROL  [initandlisten] MongoDB starting : pid=765 port=27017 dbpath=/var/lib/mongodb 64-bit host=DESKTOP-31KM97S
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten] db version v3.6.3
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten] modules: none
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten] build environment:
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten]     distarch: x86_64
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2020-05-13T16:02:24.949+0800 I CONTROL  [initandlisten] options: { config: "/etc/mongodb.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongodb.log" } }
2020-05-13T16:02:24.950+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=15824M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2020-05-13T16:02:25.328+0800 E STORAGE  [initandlisten] WiredTiger error (22) [1589356945:328952][765:0x7f4dea5410c0], connection: /var/lib/mongodb/: directory-sync: fdatasync: Invalid argument
2020-05-13T16:02:25.329+0800 F -        [initandlisten] Fatal Assertion 28561 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 410
2020-05-13T16:02:25.329+0800 F -        [initandlisten]

***aborting after fassert() failure

Activity

  1. changed the title [-]Mongodb fsync wrong in 20H1[/-] [+]Mongodb fdatasync wrong in 20H1[/+] on May 13, 2020
  2. riggzh commented on May 13, 2020

    @riggzh
    Author

    Try using as bindIP: "0.0.0.0"
    https://docs.microsoft.com/en-us/windows/wsl/compare-versions#connecting-via-remote-ip-addresses

    Same wrong, I doesn't think it's bindIP wrong. When change data path to other volumn without wslfs & drvfs. It's work. So I think its a filesystem wrong

    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten] MongoDB starting : pid=995 port=27017 dbpath=/var/lib/mongodb 64-bit host=DESKTOP-31KM97S
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten] db version v3.6.3
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.1.1  11 Sep 2018
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten] allocator: tcmalloc
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten] modules: none
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten] build environment:
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten]     distarch: x86_64
    2020-05-13T20:14:58.339+0800 I CONTROL  [initandlisten]     target_arch: x86_64
    2020-05-13T20:14:58.340+0800 I CONTROL  [initandlisten] options: { config: "/etc/mongodb.conf", net: { bindIp: "0.0.0.0" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongodb.log" } }
    2020-05-13T20:14:58.341+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=15824M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
    2020-05-13T20:14:58.741+0800 E STORAGE  [initandlisten] WiredTiger error (22) [1589372098:741553][995:0x7faebb0610c0], connection: /var/lib/mongodb/: directory-sync: fdatasync: Invalid argument
    2020-05-13T20:14:58.742+0800 F -        [initandlisten] Fatal Assertion 28561 at src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 410
    2020-05-13T20:14:58.742+0800 F -        [initandlisten]
    
    ***aborting after fassert() failure
    
  3. onomatopellan commented on May 13, 2020

    @onomatopellan

    What's the output for uname -a?

  4. riggzh commented on May 13, 2020

    @riggzh
    Author

    What's the output for uname -a?

    Linux DESKTOP-31KM97S 4.4.0-19041-Microsoft #1-Microsoft Fri Dec 06 14:06:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux

    Not check same as 19H2, but same download form microsoft store.

  5. onomatopellan commented on May 13, 2020

    @onomatopellan

    Thanks. It looks like you are still using WSL1 and this type of problems "Invalid argument" are pretty common due to lack of syscalls implementation.

    Since you are on build 19041 I recommend you using WSL2. I just tried and mongodb service works just fine.

  6. riggzh commented on May 13, 2020

    @riggzh
    Author

    Thanks. It looks like you are still using WSL1 and this type of problems "Invalid argument" are pretty common due to lack of syscalls implementation.

    Since you are on build 19041 I recommend you using WSL2. I just tried and mongodb service works just fine.

    They drop this syscall in 20H1? Not find any log. WSL2 work right

  7. onomatopellan commented on May 13, 2020

    @onomatopellan

    If it worked in build 18363 then it could be a regression.
    If you have access to a working build 18363 do this to generate a mogodb.strace file and post here the link to a gist or pastebin.
    sudo strace -o mongodb.strace -f sudo service mongodb start

    After that do the same in build 19041 so both files can be compared.

  8. riggzh commented on May 13, 2020

    @riggzh
    Author

    If it worked in build 18363 then it could be a regression.
    If you have access to a working build 18363 do this to generate a mogodb.strace file and post here the link to a gist or pastebin.
    sudo strace -o mongodb.strace -f sudo service mongodb start

    After that do the same in build 19041 so both files can be compared.

    Here gist

  9. onomatopellan commented on May 14, 2020

    @onomatopellan

    I can reproduce it in latest build 19628 too. Here's the gist of Ubuntu 20.04 WSL1:
    https://gist.github.com/onomatopellan/69c67917b25d58bfd12869089de5fa68

    Let's wait for the team to look at it.

  10. therealkenc commented on May 19, 2020

    @therealkenc

    If it worked in build 18363 then it could be a regression.

    Possible but not likely. More likely a different variable moved. In any case, from ono's gist, which has the amiable property of avoiding 9p (/mnt/c):

    83    openat(AT_FDCWD, "/var/lib/mongodb/", O_RDONLY <unfinished ...>
    90    +++ exited with 0 +++
    92    <... close resumed>)              = 0
    83    <... openat resumed>)             = 15
    91    openat(AT_FDCWD, "/usr/lib/locale/C.UTF-8/LC_TELEPHONE", O_RDONLY|O_CLOEXEC <unfinished ...>
    83    fdatasync(15 <unfinished ...>
    88    <... wait4 resumed>[{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 90
    92    openat(AT_FDCWD, "/usr/lib/locale/C.UTF-8/LC_MEASUREMENT", O_RDONLY|O_CLOEXEC <unfinished ...>
    88    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=90, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
    91    <... openat resumed>)             = 3
    83    <... fdatasync resumed>)          = -1 EINVAL (Invalid argument)
    

    Repro:

    // fdatasync.c
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <unistd.h>
    #include <stdio.h>
    
    int main(int argc, char argv[])
    {
        int fd = openat(AT_FDCWD, "/home/", O_RDONLY);
        fdatasync(fd);
        perror("fdatasync: ");
    }
    

    image

    Doing a fdatasync() on a read-only directory handle: questionable semantically but apparently allowed. WSL2:

    image

    Did 18363 eat it? Can't tell ya, don't have one handy, didn't look. Someone motivated could (I suspect academically) try the repro and confirm one way or the other.

  11. riggzh commented on May 19, 2020

    @riggzh
    Author

    therealkenc

    In 18363
    QQ截图20200519122604

  12. added
    needs-investigation
    on Jun 3, 2020
  13. therealkenc commented on Jun 3, 2020

    @therealkenc

    Why the tight repro worked in WSL1 18363 but not 19628 is a pretty legit ask. [If it never worked in WSL1 it'd be different.]

  14. removed
    needs-investigation
    on May 5, 2021
  15. aak1247 commented on Dec 21, 2021

    @aak1247

    reproduced in 19041 too

  16. bilaalabdelhassan commented on Jan 28, 2022

    @bilaalabdelhassan

    Thanks. It looks like you are still using WSL1 and this type of problems "Invalid argument" are pretty common due to lack of syscalls implementation.

    Since you are on build 19041 I recommend you using WSL2. I just tried and mongodb service works just fine.

    Thanks a lot, I've been stuck with it for days. Switching to WSL 2 worked for me.

  17. KashubaK commented on May 25, 2022

    @KashubaK

    Switching to WSL 2 is not preferable for all cases. As a web dev, it requires me to use polling for any sort of task that relies on "watching" files (i.e. recompile on file save), and other FS-related tasks become very slow (see relevant StackOverflow post)

    Would be nice if this was figured out, but I'll just use Mongo Atlas in the meantime.

  18. MaheshMadushan commented on Dec 25, 2022

    @MaheshMadushan

    same issue arise when try to run leveldb. is it ideal to use fsync instead of fdatasync ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions