dani-garcia / vaultwarden

Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
GNU Affero General Public License v3.0
38.47k stars 1.87k forks source link

Takes a long time to load on Ubuntu 19.10 #875

Closed uchagani closed 4 years ago

uchagani commented 4 years ago

Subject of the issue

bitwarden_rs takes a long time to load on Ubuntu 19.10.

Your environment

Steps to reproduce

On Ubuntu 19.10 run docker run -d --name bitwarden -v /home/umair/bw-data/:/data/ -p 8080:80 -e LOG_FILE=/data/bitwarden.log -e EXTENDED_LOGGING=true -e LOG_LEVEL=trace bitwardenrs/server:latest

Open firefox to your http://ipaddress:8080

Expected behaviour

Bitwarden should load as normal

Actual behaviour

Logo is shown and bitwarden takes 10min to load.

Image:

image

Relevant logs

I upped the log level to trace

jjlin commented 4 years ago

Try adding -e DOMAIN=http://ipaddress:8080 to your docker run

uchagani commented 4 years ago

doesn't help. i removed the container and reran it with -e DOMAIN=http://192.168.xxx.xxx:8080

Log file just keeps repeating this:

[2020-02-25 05:10:10][hyper::buffer][TRACE] get_buf []
[2020-02-25 05:10:10][hyper::buffer][TRACE] read_into_buf buf[0..4096]
[2020-02-25 05:10:10][hyper::buffer][TRACE] get_buf [u8; 4096][0..78]
[2020-02-25 05:10:10][hyper::http::h1][TRACE] try_parse([71, 69, 84, 32, 47, 97, 108, 105, 118, 101, 32, 72, 84, 84, 80, 47, 49, 46, 49, 13, 10, 72, 111, 115, 116, 58, 32, 108, 111, 99, 97, 108, 104, 111, 115, 116, 13, 10, 85, 115, 101, 114, 45, 65, 103, 101, 110, 116, 58, 32, 99, 117, 114, 108, 47, 55, 46, 54, 52, 46, 48, 13, 10, 65, 99, 99, 101, 112, 116, 58, 32, 42, 47, 42, 13, 10, 13, 10])
[2020-02-25 05:10:10][hyper::http::h1][TRACE] Request.try_parse([Header; 100], [u8; 78])
[2020-02-25 05:10:10][hyper::http::h1][TRACE] Request.try_parse Complete(78)
[2020-02-25 05:10:10][hyper::header][TRACE] raw header: "Host"=[108, 111, 99, 97, 108, 104, 111, 115, 116]
[2020-02-25 05:10:10][hyper::header][TRACE] raw header: "User-Agent"=[99, 117, 114, 108, 47, 55, 46, 54, 52, 46, 48]
[2020-02-25 05:10:10][hyper::header][TRACE] raw header: "Accept"=[42, 47, 42]
[2020-02-25 05:10:10][hyper::http][TRACE] should_keep_alive( Http11, None )
[2020-02-25 05:10:10][request][INFO] GET /alive
[2020-02-25 05:10:10][response][INFO] GET /alive (alive) => 200 OK
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "Content-Type", [97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "Server", [82, 111, 99, 107, 101, 116] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "Feature-Policy", [97, 99, 99, 101, 108, 101, 114, 111, 109, 101, 116, 101, 114, 32, 39, 110, 111, 110, 101, 39, 59, 32, 97, 109, 98, 105, 101, 110, 116, 45, 108, 105, 103, 104, 116, 45, 115, 101, 110, 115, 111, 114, 32, 39, 110, 111, 110, 101, 39, 59, 32, 97, 117, 116, 111, 112, 108, 97, 121, 32, 39, 110, 111, 110, 101, 39, 59, 32, 99, 97, 109, 101, 114, 97, 32, 39, 110, 111, 110, 101, 39, 59, 32, 101, 110, 99, 114, 121, 112, 116, 101, 100, 45, 109, 101, 100, 105, 97, 32, 39, 110, 111, 110, 101, 39, 59, 32, 102, 117, 108, 108, 115, 99, 114, 101, 101, 110, 32, 39, 110, 111, 110, 101, 39, 59, 32, 103, 101, 111, 108, 111, 99, 97, 116, 105, 111, 110, 32, 39, 110, 111, 110, 101, 39, 59, 32, 103, 121, 114, 111, 115, 99, 111, 112, 101, 32, 39, 110, 111, 110, 101, 39, 59, 32, 109, 97, 103, 110, 101, 116, 111, 109, 101, 116, 101, 114, 32, 39, 110, 111, 110, 101, 39, 59, 32, 109, 105, 99, 114, 111, 112, 104, 111, 110, 101, 32, 39, 110, 111, 110, 101, 39, 59, 32, 109, 105, 100, 105, 32, 39, 110, 111, 110, 101, 39, 59, 32, 112, 97, 121, 109, 101, 110, 116, 32, 39, 110, 111, 110, 101, 39, 59, 32, 112, 105, 99, 116, 117, 114, 101, 45, 105, 110, 45, 112, 105, 99, 116, 117, 114, 101, 32, 39, 110, 111, 110, 101, 39, 59, 32, 115, 121, 110, 99, 45, 120, 104, 114, 32, 39, 115, 101, 108, 102, 39, 32, 104, 116, 116, 112, 115, 58, 47, 47, 104, 97, 118, 101, 105, 98, 101, 101, 110, 112, 119, 110, 101, 100, 46, 99, 111, 109, 32, 104, 116, 116, 112, 115, 58, 47, 47, 116, 119, 111, 102, 97, 99, 116, 111, 114, 97, 117, 116, 104, 46, 111, 114, 103, 59, 32, 117, 115, 98, 32, 39, 110, 111, 110, 101, 39, 59, 32, 118, 114, 32, 39, 110, 111, 110, 101, 39] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "Referrer-Policy", [115, 97, 109, 101, 45, 111, 114, 105, 103, 105, 110] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "X-Frame-Options", [83, 65, 77, 69, 79, 82, 73, 71, 73, 78] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "X-Content-Type-Options", [110, 111, 115, 110, 105, 102, 102] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "X-XSS-Protection", [49, 59, 32, 109, 111, 100, 101, 61, 98, 108, 111, 99, 107] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "Content-Security-Policy", [102, 114, 97, 109, 101, 45, 97, 110, 99, 101, 115, 116, 111, 114, 115, 32, 39, 115, 101, 108, 102, 39, 32, 99, 104, 114, 111, 109, 101, 45, 101, 120, 116, 101, 110, 115, 105, 111, 110, 58, 47, 47, 110, 110, 103, 99, 101, 99, 107, 98, 97, 112, 101, 98, 102, 105, 109, 110, 108, 110, 105, 105, 105, 97, 104, 107, 97, 110, 100, 99, 108, 98, 108, 98, 32, 109, 111, 122, 45, 101, 120, 116, 101, 110, 115, 105, 111, 110, 58, 47, 47, 42, 32, 59] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "Cache-Control", [110, 111, 45, 99, 97, 99, 104, 101, 44, 32, 110, 111, 45, 115, 116, 111, 114, 101, 44, 32, 109, 97, 120, 45, 97, 103, 101, 61, 48] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.append_raw( "Access-Control-Allow-Origin", [] )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.set( "Content-Length", ContentLength(29) )
[2020-02-25 05:10:10][hyper::header][TRACE] Headers.set( "Date", Date(HttpDate(Tm { tm_sec: 10, tm_min: 10, tm_hour: 5, tm_mday: 25, tm_mon: 1, tm_year: 120, tm_wday: 2, tm_yday: 55, tm_isdst: 0, tm_utcoff: 0, tm_nsec: 450155579 })) )
[2020-02-25 05:10:10][hyper::http][TRACE] should_keep_alive( Http11, None )
[2020-02-25 05:10:10][hyper::buffer][TRACE] get_buf []
[2020-02-25 05:10:10][hyper::buffer][TRACE] reserved 0
[2020-02-25 05:10:10][hyper::buffer][TRACE] read_into_buf buf[0..0]
[2020-02-25 05:10:10][hyper::buffer][TRACE] read_into_buf at full capacity
[2020-02-25 05:10:10][hyper::buffer][TRACE] get_buf []
jjlin commented 4 years ago

Try opening the browser dev tools (usually pressing F12 works) and go to the network tab to see what requests are getting stuck or failing. You may have to reload the page to see it.

uchagani commented 4 years ago

All the other requests took between 3-8 seconds except for the initial request. I double checked..it's seconds not milliseconds.

jjlin commented 4 years ago

Anything special about the networking between your computer and the Docker host? It seems it's very slow for some reason.

uchagani commented 4 years ago

Not that I think. Here are some results from iperf3 between the docker host and my laptop where i'm accessing bitwarden from.

~: iperf3 -c 192.168.10.107 -f M
Connecting to host 192.168.10.107, port 5201
[  5] local 192.168.1.139 port 55034 connected to 192.168.10.107 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  2.98 MBytes  2.98 MBytes/sec
[  5]   1.00-2.00   sec  3.32 MBytes  3.32 MBytes/sec
[  5]   2.00-3.00   sec  4.33 MBytes  4.33 MBytes/sec
[  5]   3.00-4.00   sec  5.98 MBytes  5.98 MBytes/sec
[  5]   4.00-5.00   sec  8.63 MBytes  8.62 MBytes/sec
[  5]   5.00-6.00   sec  12.5 MBytes  12.5 MBytes/sec
[  5]   6.00-7.00   sec  17.0 MBytes  17.0 MBytes/sec
[  5]   7.00-8.00   sec  21.3 MBytes  21.3 MBytes/sec
[  5]   8.00-9.00   sec  26.2 MBytes  26.2 MBytes/sec
[  5]   9.00-10.00  sec  29.0 MBytes  29.0 MBytes/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec   131 MBytes  13.1 MBytes/sec                  sender
[  5]   0.00-10.01  sec   131 MBytes  13.1 MBytes/sec                  receiver
uchagani commented 4 years ago

I wanted to make sure there was nothing funky going on from within docker so on my docker host I removed iperf3 and ran iperf3 via docker using the image networkstatic/iperf3. Connected to this via my laptop again and the results are below:

Connecting to host 192.168.10.107, port 5201
[  5] local 192.168.1.139 port 55271 connected to 192.168.10.107 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  38.7 MBytes   324 Mbits/sec
[  5]   1.00-2.00   sec  37.0 MBytes   310 Mbits/sec
[  5]   2.00-3.00   sec  35.8 MBytes   300 Mbits/sec
[  5]   3.00-4.00   sec  37.4 MBytes   314 Mbits/sec
[  5]   4.00-5.00   sec  35.5 MBytes   298 Mbits/sec
[  5]   5.00-6.00   sec  36.3 MBytes   305 Mbits/sec
[  5]   6.00-7.00   sec  36.7 MBytes   308 Mbits/sec
[  5]   7.00-8.00   sec  35.8 MBytes   300 Mbits/sec
[  5]   8.00-9.00   sec  37.3 MBytes   313 Mbits/sec
[  5]   9.00-10.00  sec  37.5 MBytes   315 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec   368 MBytes   309 Mbits/sec                  sender
[  5]   0.00-10.00  sec   367 MBytes   308 Mbits/sec                  receiver
uchagani commented 4 years ago

this seemed to be an issue with one of my NICs.