EbTech / Elo-MMR

Skill estimation systems for multiplayer competitions
https://arxiv.org/abs/2101.00400
MIT License
175 stars 24 forks source link

Duplicate Handle: BorrowMutError, multi-skill\src\system\common\mod.rs:144:18 #15

Closed stephankokkas closed 2 years ago

stephankokkas commented 2 years ago

I have three massive datasets (150k json files in each dir). Initially, I had all three dataset in the caches folder and ran the following command:

cargo run --release --bin rate mmr dataset1

This completed successfully and had no issues. However, when I went to run the second and third dataset with the following command:

cargo run --release --bin rate mmr dataset2

I received the following error:

INFO multi_skill::data_processing::dataset: Found 127498 JSON files at "../cache/dataset2"
thread 'main' panicked at 'Duplicate handle: BorrowMutError', multi-skill\src\system\common\mod.rs:144:18
note: run with `RUST_BACKTRACK=1` environment variable to display a backtrace
error: process didn't exit successfully (exit code: 101)

I then through that perhaps it was an issue that within the JSON files, the event names were the same so I changed that but it did not resolve the issue. I then created two whole new directory and re-downloaded the GitHub repo again and created one each for each of my large datasets but the issue was not resolved.

Additionally, if I re-run the first dataset - there is no issue it will complete successfully.

stephankokkas commented 2 years ago

@EbTech with RUST_BACKTRACE=full I receive the following breadcrumb if it helps..

     Running `C:\Users\ProductionServer\Documents\Ruby Environment\11 - Elo-MMR-master JID\target\release\rate.exe mmr JID`
2022-04-04T23:41:04.768439Z  INFO multi_skill::data_processing::dataset: Found 127498 JSON files at "../cache/JID"
thread 'main' panicked at 'Duplicate handle: BorrowMutError', multi-skill\src\systems\common\mod.rs:144:18
stack backtrace:
   0:     0x7ff64d4a056f - std::backtrace_rs::backtrace::dbghelp::trace::ha452afab0d9713fc
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\..\..\backtrace\src\backtrace/dbghelp.rs:98:5
   1:     0x7ff64d4a056f - std::backtrace_rs::backtrace::trace_unsynchronized::h022797ee94fa2fae
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\..\..\backtrace\src\backtrace/mod.rs:66:5
   2:     0x7ff64d4a056f - std::sys_common::backtrace::_print_fmt::h61a7e2552262c801
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common/backtrace.rs:67:5
   3:     0x7ff64d4a056f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5439f83bea698841
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common/backtrace.rs:46:22
   4:     0x7ff64d4fcd0a - core::fmt::write::h95a57c545101328b
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\core\src\fmt/mod.rs:1168:17
   5:     0x7ff64d490da1 - std::io::Write::write_fmt::hc9b12c08b860c754
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\io/mod.rs:1660:15
   6:     0x7ff64d4a3c95 - std::sys_common::backtrace::_print::h1f6d4151cfab0d62
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common/backtrace.rs:49:5
   7:     0x7ff64d4a3c95 - std::sys_common::backtrace::print::hb581c08430c00a3c
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common/backtrace.rs:36:9
   8:     0x7ff64d4a3c95 - std::panicking::default_hook::{{closure}}::h5d5feacbba4e599c
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:211:50
   9:     0x7ff64d4a3855 - std::panicking::default_hook::h631b1c94c0ce7a2b
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:228:9
  10:     0x7ff64d4a42df - std::panicking::rust_panic_with_hook::h48328f46baf0259d
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:606:17
  11:     0x7ff64d4a41d3 - std::panicking::begin_panic_handler::{{closure}}::hfa2e065763334115
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:502:13
  12:     0x7ff64d4a0f67 - std::sys_common::backtrace::__rust_end_short_backtrace::h25ab5483aa0d4b62
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src\sys_common/backtrace.rs:139:18
  13:     0x7ff64d4a3f19 - rust_begin_unwind
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:498:5
  14:     0x7ff64d4f97e0 - core::panicking::panic_fmt::h2d11b48d90a20930
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\core\src/panicking.rs:116:14
  15:     0x7ff64d4f9b43 - core::result::unwrap_failed::h6dba03bbf003e7d3
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\core\src/result.rs:1690:5
  16:     0x7ff64d13070a - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h3e8d48f6f0b61293
  17:     0x7ff64d164cce - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::h15ed8bf327791254
  18:     0x7ff64d148a20 - multi_skill::systems::common::simulate_contest::hd615b5f0dada2be5
  19:     0x7ff64d16ba66 - multi_skill::experiment_config::Experiment::eval::h33bed0ddc7e29e67
  20:     0x7ff64d0d64d5 - rate::main::hbf47ecdb7ee032c0
  21:     0x7ff64d0d5ae6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h95e32f3f6f01ca28
  22:     0x7ff64d0d5acc - std::rt::lang_start::{{closure}}::he6be3b0ee1e2388d
  23:     0x7ff64d49fecb - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h6c46e3f058cd67e2
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\library\core\src\ops/function.rs:259:13
  24:     0x7ff64d49fecb - std::panicking::try::do_call::h241f9c3ccff2487f
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:406:40
  25:     0x7ff64d49fecb - std::panicking::try::hfa8a38622a6d88f3
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:370:19
  26:     0x7ff64d49fecb - std::panic::catch_unwind::h479992f6db7a8b35
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panic.rs:133:14
  27:     0x7ff64d49fecb - std::rt::lang_start_internal::{{closure}}::h7bad8cbcca23ae6a
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/rt.rs:128:48
  28:     0x7ff64d49fecb - std::panicking::try::do_call::hb8fc98a7abcfe5f4
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:406:40
  29:     0x7ff64d49fecb - std::panicking::try::h14d95235eb0b7795
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panicking.rs:370:19
  30:     0x7ff64d49fecb - std::panic::catch_unwind::h7e9b2346416deeaf
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/panic.rs:133:14
  31:     0x7ff64d49fecb - std::rt::lang_start_internal::h01a1849f2e20983d
                               at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a\/library\std\src/rt.rs:128:20
  32:     0x7ff64d0d7438 - main
  33:     0x7ff64d0d13b1 - __tmainCRTStartup
                               at C:\M\mingw-w64-crt-git\src\crt-x86_64-w64-mingw32\C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:321:15
  34:     0x7ff64d0d14e6 - mainCRTStartup
                               at C:\M\mingw-w64-crt-git\src\crt-x86_64-w64-mingw32\C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt\crtexe.c:202:9
  35:     0x7ffa38a87034 - <unknown>
  36:     0x7ffa3a602651 - <unknown>
error: process didn't exit successfully: `C:\Users\ProductionServer\Documents\Ruby Environment\11 - Elo-MMR-master JID\target\release\rate.exe mmr JID` (exit code: 101)
EbTech commented 2 years ago

Since the error says "Duplicate handle", did you check whether one of the contests has two players with the same name? You can set the environment variable RUST_LOG=debug to print more information that would identify which specific contest it crashed on.

stephankokkas commented 2 years ago

Fantastic - Thank you

stephankokkas commented 2 years ago

@EbTech would there be a way to allow duplicate handles? For example, assume a competition where there is a competitor and a trainer of that competitor. The competitor is distinct but the trainer is allowed to train more than one competitor and so if I want to generate ratings for the trainers, how would that work if for a simple competition the trainer resulted both 1st, 3rd, and 8th for example...

EbTech commented 2 years ago

Hmm that's a very different model and it depends. For example, do you want more weight on the trainer's best contestant, or on their average? A few different approaches you could take: