Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: GcCell<T> already borrowed #2670

Closed
langston-barrett opened this issue Mar 15, 2023 · 1 comment
Closed

panic: GcCell<T> already borrowed #2670

langston-barrett opened this issue Mar 15, 2023 · 1 comment
Labels
bug Something isn't working gc Issue related to garbage collection

Comments

@langston-barrett
Copy link

langston-barrett commented Mar 15, 2023

This is an odd one! It actually seems to require a bunch of newlines.

Found with tree-splicer, reduced with treereduce.

list = [Number, Function];
ws = new WeakSet(list);   




ws = new WeakSet(new Set(list));
[ {
EPSILON: 2.220446049250313e-16,
MAX_SAFE_INTEGER: 9007199254740991,
MIN_SAFE_INTEGER: -9007199254740991,
MAX_VALUE: 1.7976931348623157e+308,
MIN_VALUE: 2.2250738585072014e-308,
NEGATIVE_INFINITY: -Infinity,
POSITIVE_INFINITY: Infinity,
 NaN: NaN,
parseInt: {
  length: 2,
    name: "parseInt"
    },
parseFloat: {
  length: 1,
    name: "parseFloat"
    },
isFinite: {
  length: 1,
    name: "isFinite"
    },
isNaN: {
  length: 1,
    name: "isNaN"
    },
isSafeInteger: {
  length: 1,
    name: "isSafeInteger"
    },
isInteger: {
  length: 1,
    name: "isInteger"
    },
prototype: {
toExponential: {
      length: 1,
        name: "toExponential"
        },
 toFixed: {
      length: 1,
        name: "toFixed"
        },
toLocaleString: {
      length: 0,
        name: "toLocaleString"
        },
toPrecision: {
      length: 1,
        name: "toPrecision"
        },
toString: {
      length: 1,
        name: "toString"
        },
 valueOf: {
      length: 0,
        name: "valueOf"
        },
constructor: [Cycle]
    },
length: 1,
name: "Number"
}, {
prototype: {
  length: 0,
    name: "",
   apply: {
      length: 2,
        name: "apply"
        },
    bind: {
      length: 1,
        name: "bind"
        },
    call: {
      length: 1,
        name: "call"
        },
toString: {
      length: 0,
        name: "toString"
        },
  caller: Getter & Setter,
arguments: Getter & Setter,
constructor: [Cycle],
Symbol(Symbol.hasInstance): {
      length: 1,
        name: "[Symbol.iterator]"
        }
    },
length: 1,
name: "Function"
} ]
{

}
undefined
undefined
undefined
undefined
thread 'main' panicked at 'GcCell<T> already borrowed', /home/langston/code/boa/boa_gc/src/cell.rs:167:23
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panicking.rs:64:14
   2: core::panicking::panic_display
   3: <boa_gc::internals::weak_map_box::WeakMapBox<K,V> as boa_gc::internals::weak_map_box::ErasedWeakMapBox>::clear_dead_entries
   4: boa_gc::Allocator::manage_state
   5: boa_gc::pointers::weak::WeakGc<T>::new
   6: boa_gc::pointers::weak_map::WeakMap<K,V>::contains_key
   7: boa_engine::builtins::weak_set::WeakSet::add
   8: boa_engine::vm::code_block::<impl boa_engine::object::jsobject::JsObject>::call_internal
   9: boa_engine::object::internal_methods::function::function_call{{reify.shim}}
  10: <boa_engine::builtins::weak_set::WeakSet as boa_engine::builtins::BuiltInConstructor>::constructor
  11: boa_engine::object::internal_methods::function::function_construct{{reify.shim}}
  12: <boa_engine::vm::opcode::new::New as boa_engine::vm::opcode::Operation>::execute
  13: boa_engine::vm::<impl boa_engine::context::Context>::execute_instruction
  14: boa_engine::vm::<impl boa_engine::context::Context>::run
  15: boa_engine::context::Context::execute
  16: boa_engine::context::Context::eval_script
  17: boa::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Build environment (please complete the following information):

  • OS: NixOS
  • Target triple: x86_64-unknown-linux-gnu
  • Rustc version: 1.68
@langston-barrett langston-barrett added the bug Something isn't working label Mar 15, 2023
@jedel1043 jedel1043 added the gc Issue related to garbage collection label Mar 16, 2023
@jedel1043
Copy link
Member

Will close this in favour of #2732, since they seem to have the same root cause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gc Issue related to garbage collection
Projects
None yet
Development

No branches or pull requests

2 participants