raftario / filite

A simple, light and standalone pastebin, URL shortener and file-sharing service
MIT License
190 stars 16 forks source link

Service hangs up without any response #21

Closed Orhideous closed 2 years ago

Orhideous commented 4 years ago

Installed 0.3.0 from releases.

Config

port = 8080
database_url = "/root/.local/share/filite/database.db"
pool_size = 1
files_dir = "/root/.local/share/filite/files"

[highlight]
theme = "github"
languages = ["rust"]

Upload

curl -u luna:pass -X POST -F test.z=@/usr/share/vim/vimrc localhost:8080/f

Result

thread 'actix-web' panicked at 'called `Result::unwrap()` on an `Err` value: Error(None)', src/libcore/result.rs:1165:5
thread 'actix-web' panicked at 'called `Result::unwrap()` on an `Err` value: Error(None)', src/libcore/result.rs:1165:5
stack backtrace:
   0:     0x55fa42e33364 - backtrace::backtrace::libunwind::trace::hda41dbcdfba36aa0
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1:     0x55fa42e33364 - backtrace::backtrace::trace_unsynchronized::h1a8d6e1f8cb3f5d4
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2:     0x55fa42e33364 - std::sys_common::backtrace::_print_fmt::h610c4127487e10da
                               at src/libstd/sys_common/backtrace.rs:76
   3:     0x55fa42e33364 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0722dc552e01bd1d
                               at src/libstd/sys_common/backtrace.rs:60
   4:     0x55fa42e5644c - core::fmt::write::h01edf6dd68a42c9c
                               at src/libcore/fmt/mod.rs:1030
   5:     0x55fa42e2e4c7 - std::io::Write::write_fmt::hf15985f193f03c04
                               at src/libstd/io/mod.rs:1412
   6:     0x55fa42e35895 - std::sys_common::backtrace::_print::hd8d5d08a1795e743
                               at src/libstd/sys_common/backtrace.rs:64
   7:     0x55fa42e35895 - std::sys_common::backtrace::print::hf89a79e3921a2366
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x55fa42e35895 - std::panicking::default_hook::{{closure}}::h3a8f42beb3bb8ae3
                               at src/libstd/panicking.rs:196
   9:     0x55fa42e35586 - std::panicking::default_hook::h8f803b0bc31a5c37
                               at src/libstd/panicking.rs:210
  10:     0x55fa42e35f95 - std::panicking::rust_panic_with_hook::h825f041245da8739
                               at src/libstd/panicking.rs:473
  11:     0x55fa42e35b32 - std::panicking::continue_panic_fmt::hbe0378e33481e81b
                               at src/libstd/panicking.rs:380
  12:     0x55fa42e35a26 - rust_begin_unwind
                               at src/libstd/panicking.rs:307
  13:     0x55fa42e52b4a - core::panicking::panic_fmt::h527855ce0bc891f6
                               at src/libcore/panicking.rs:85
  14:     0x55fa42e52c47 - core::result::unwrap_failed::ha8b77e6004f0ba38
                               at src/libcore/result.rs:1165
  15:     0x55fa422bd2c0 - core::result::Result<T,E>::unwrap::h21ee83cd6b2c843d
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/result.rs:933
  16:     0x55fa420fac01 - filite::queries::files::find::h809f8f6254cc9b90
                               at src/queries.rs:60
  17:     0x55fa420fa477 - filite::queries::files::replace::hb4029f994f19abf4
                               at src/queries.rs:137
  18:     0x55fa4223e505 - filite::routes::files::put_post::{{closure}}::{{closure}}::h0f7f239e8387f156
                               at src/routes.rs:386
  19:     0x55fa4223857c - actix_threadpool::run::{{closure}}::{{closure}}::haa1e2b11cf78add1
                               at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/actix-threadpool-0.3.1/src/lib.rs:63
  20:     0x55fa42239702 - <F as threadpool::FnBox>::call_box::hed80014852094c62
                               at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/threadpool-1.7.1/src/lib.rs:95
  21:     0x55fa42a82818 - threadpool::spawn_in_pool::{{closure}}::h7e46ed507619a800
                               at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/threadpool-1.7.1/src/lib.rs:767
  22:     0x55fa42a7e7c3 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd032c6bd60d4bb43
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/sys_common/backtrace.rs:126
  23:     0x55fa42a73f0f - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::hb920c46fc29b2953
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/thread/mod.rs:470
  24:     0x55fa42a7e7a2 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h168fffd117c6eacf
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panic.rs:315
  25:     0x55fa42a7678a - std::panicking::try::do_call::h1076ad2f5efacc8f
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panicking.rs:292
  26:     0x55fa42e3a7da - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:80
  27:     0x55fa42a76627 - std::panicking::try::hf1e36f1ebc83c33b
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panicking.rs:271
  28:     0x55fa42a7ee04 - std::panic::catch_unwind::hcfc7851d11911124
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/panic.rs:394
  29:     0x55fa42a73d1a - std::thread::Builder::spawn_unchecked::{{closure}}::hefa782d3e7b7be16
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libstd/thread/mod.rs:469
  30:     0x55fa42a77464 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h51e5352323a1df55
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/libcore/ops/function.rs:227
  31:     0x55fa42e26ccf - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h483711add4ba2330
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
  32:     0x55fa42e39bd0 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h7605b45eb29ed0be
                               at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
  33:     0x55fa42e39bd0 - std::sys_common::thread::start_thread::h557b0c2dc4449562
                               at src/libstd/sys_common/thread.rs:13
  34:     0x55fa42e39bd0 - std::sys::unix::thread::Thread::new::thread_start::h7c2a7f9b68fe4bba
                               at src/libstd/sys/unix/thread.rs:79
  35:     0x7f6d6a487669 - start_thread
  36:     0x7f6d6a5c9323 - clone
  37:                0x0 - <unknown>

[2020-04-05T15:48:58Z INFO  actix_web::middleware::logger] 127.0.0.1:42894 "POST /f HTTP/1.1" 500 21 "-" "curl/7.58.0" 30.200412

But file actually saved,

ls /root/.local/share/filite/files
q8bo4a.vimrc
Orhideous commented 4 years ago

I figured that this happens when pool_size set to 1.

raftario commented 4 years ago

Thanks for the report. I don't really have much time to look into it currently so I'd just set it to 2+ in the meantime.

sjm42 commented 3 years ago

I ran into the same issue. Maybe there is sort of race condition: the sql connection pool size is 1, there is already one occupied connection and the software needs another connection for a query and then ends up with a deadlock waiting for the single connection to free up and it never happens.