denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.25k stars 5.41k forks source link

Temporal: Deno got into panic when trying to get `era` of Non-ISO 8601 calendars #27118

Open 4513ECHO opened 6 days ago

4513ECHO commented 6 days ago

Version: Deno 2.1.1 OS: macOS Sonoma 14.7

In deno eval --unstable-temporal, following code will cause a panic:

Deno 2.1.1
exit using ctrl+d, ctrl+c, or close()
> Temporal.PlainDate.from("2024-11-28[u-ca=japanese]").era

#
# Fatal error in , line 0
# unimplemented code
#
#
#
#FailureMessage Object: 0x16af23b88
==== C stack trace ===============================

    0   deno                                0x0000000106787ea4 v8::base::debug::StackTrace::StackTrace() + 24
    1   deno                                0x000000010678d7b8 v8::platform::(anonymous namespace)::PrintStackTrace() + 24
    2   deno                                0x0000000106784e5c V8_Fatal(char const*, ...) + 356
    3   deno                                0x0000000106c1bb4c v8::internal::JSTemporalCalendar::EraYear(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSTemporalCalendar>, v8::internal::
Handle<v8::internal::Object>) + 0
    4   deno                                0x000000010683bb1c v8::internal::Builtin_TemporalCalendarPrototypeEra(int, unsigned long*, v8::internal::Isolate*) + 124
    5   deno                                0x0000000107b44dd4 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit + 84
    6   deno                                0x0000000107aa666c Builtins_JSEntryTrampoline + 172
    7   deno                                0x0000000107aa6310 Builtins_JSEntry + 176
    8   deno                                0x00000001068e5040 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 1588
    9   deno                                0x00000001068e49dc v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Obj
ect>, int, v8::internal::Handle<v8::internal::Object>*) + 120
    10  deno                                0x0000000106c0e998 v8::internal::temporal::CalendarEra(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::int
ernal::JSReceiver>) + 204
    11  deno                                0x000000010683bdd8 v8::internal::Builtin_TemporalPlainDatePrototypeEra(int, unsigned long*, v8::internal::Isolate*) + 128
    12  deno                                0x0000000107b44dd4 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit + 84
    13  deno                                0x0000000107ab8258 Builtins_LoadIC_NoFeedback + 4056
    14  deno                                0x0000000107c20c78 Builtins_GetNamedPropertyHandler + 4728
    15  deno                                0x0000000107aa89f8 Builtins_InterpreterEntryTrampoline + 280
    16  deno                                0x0000000107aa666c Builtins_JSEntryTrampoline + 172
    17  deno                                0x0000000107aa6310 Builtins_JSEntry + 176
    18  deno                                0x00000001068e5040 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 1588
    19  deno                                0x00000001068e564c v8::internal::Execution::CallScript(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Handle<v8::int
ernal::Object>, v8::internal::Handle<v8::internal::Object>) + 132
    20  deno                                0x000000010689e610 v8::internal::DebugEvaluate::Global(v8::internal::Isolate*, v8::internal::Handle<v8::internal::String>, v8::debug::EvaluateGlobalMode, v
8::internal::REPLMode) + 332
    21  deno                                0x00000001068a9e00 v8::debug::EvaluateGlobal(v8::Isolate*, v8::Local<v8::String>, v8::debug::EvaluateGlobalMode, bool) + 184
    22  deno                                0x0000000107346734 v8_inspector::V8RuntimeAgentImpl::evaluate(v8_inspector::String16 const&, v8_crdtp::detail::ValueMaybe<v8_inspector::String16>, v8_crdtp
::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<int>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe
<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<double>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp:
:detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<v8_inspector::String16>, v8_crdtp::detail::PtrMaybe<v8_inspector::protocol::Runtime::SerializationOptions>, std::__Cr::unique_ptr<v8_inspector:
:protocol::Runtime::Backend::EvaluateCallback, std::__Cr::default_delete<v8_inspector::protocol::Runtime::Backend::EvaluateCallback>>) + 940
    23  deno                                0x00000001072eae4c v8_inspector::protocol::Runtime::DomainDispatcherImpl::evaluate(v8_crdtp::Dispatchable const&) + 636
    24  deno                                0x0000000107364d28 v8_crdtp::UberDispatcher::DispatchResult::Run() + 40
    25  deno                                0x0000000107340ea8 v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView) + 468
    26  deno                                0x00000001067839fc v8_inspector__V8InspectorSession__dispatchProtocolMessage + 44
    27  deno                                0x00000001054958c8 _ZN87_$LT$deno_core..inspector..InspectorSession$u20$as$u20$futures_core..stream..Stream$GT$9poll_next17h2d0ff313a9fa1493E + 240
    28  deno                                0x00000001054952d4 deno_core::inspector::JsRuntimeInspector::poll_sessions::h3cb79f0bc20450b5 + 880
    29  deno                                0x00000001055208c8 deno_core::runtime::jsruntime::JsRuntime::poll_event_loop::hdde3da0f976e8d60 + 404
    30  deno                                0x00000001051115fc _ZN9deno_core7runtime9jsruntime9JsRuntime22with_event_loop_future28_$u7b$$u7b$closure$u7d$$u7d$17h79435de154e5ccd6E + 116
    31  deno                                0x00000001052725b8 _ZN4deno5tools4repl7session11ReplSession28post_message_with_event_loop28_$u7b$$u7b$closure$u7d$$u7d$17hac66a658310b5a52E + 116
    32  deno                                0x0000000105275128 _ZN4deno5tools4repl7session11ReplSession19evaluate_expression28_$u7b$$u7b$closure$u7d$$u7d$17h8472b9cb10e78062E + 176
    33  deno                                0x0000000105274d2c _ZN4deno5tools4repl7session11ReplSession22evaluate_ts_expression28_$u7b$$u7b$closure$u7d$$u7d$17hd96f02ce35996413E + 2516
    34  deno                                0x0000000105273914 _ZN4deno5tools4repl7session11ReplSession34evaluate_line_with_object_wrapping28_$u7b$$u7b$closure$u7d$$u7d$17h6de43dd61f9cf9d4E + 284
    35  deno                                0x0000000105272850 _ZN4deno5tools4repl7session11ReplSession28evaluate_line_and_get_output28_$u7b$$u7b$closure$u7d$$u7d$17heb55cab8d8fd7e2eE + 156
    36  deno                                0x0000000105277c5c _ZN4deno5tools4repl3run28_$u7b$$u7b$closure$u7d$$u7d$17h01792d2d83e52cb2E + 10480
    37  deno                                0x00000001052aec58 _ZN4deno16spawn_subcommand28_$u7b$$u7b$closure$u7d$$u7d$17h283fbb92f4a3b6e1E + 192
    38  deno                                0x0000000104edab20 _ZN100_$LT$deno_unsync..tokio..task..MaskFutureAsSend$LT$F$GT$$u20$as$u20$core..future..future..Future$GT$4poll17h0f21cc1725a1b6cdE + 28
    39  deno                                0x000000010505cfac tokio::runtime::task::raw::poll::h82f097423786f2a6 + 88
    40  deno                                0x00000001052be3ec deno::main::h4da7c7f8eefca462 + 3632
    41  deno                                0x0000000104f7ee04 std::sys::backtrace::__rust_begin_short_backtrace::h0c730e3ff58a8863 + 12
    42  deno                                0x0000000105311410 main + 700
    43  dyld                                0x000000018eb2b154 start + 2476
MohammadSu1 commented 1 day ago

@bartlomieju, Regarding this issue, we need to handle the panic correctly or add the era functionality. When I tried to reproduce the issue, I found that using the era caused the panic.