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

Several Date tests panic on Windows #1570

Closed
jedel1043 opened this issue Sep 10, 2021 · 6 comments
Closed

Several Date tests panic on Windows #1570

jedel1043 opened this issue Sep 10, 2021 · 6 comments
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics help wanted Extra attention is needed windows Issues and PRs related to the Windows platform.

Comments

@jedel1043
Copy link
Member

jedel1043 commented Sep 10, 2021

Describe the bug
Several tests related to the Date object panic on Windows

Panicking tests:

  • test\annexB\built-ins\Date\prototype\setYear\year-number-absolute.js
thread 'main' panicked at 'TzSpecificLocalTimeToSystemTime failed with: The parameter is incorrect. (os error 87)', ...\chrono-0.4.19\src\sys\windows.rs:127:9
  • test\annexB\built-ins\Date\prototype\setYear\year-number-relative.js
thread 'main' panicked at 'TzSpecificLocalTimeToSystemTime failed with: The parameter is incorrect. (os error 87)', ...\chrono-0.4.19\src\sys\windows.rs:127:9
  • test\built-ins\Date\prototype\setFullYear\arg-year-to-number.js
thread 'main' panicked at 'TzSpecificLocalTimeToSystemTime failed with: The parameter is incorrect. (os error 87)', ...\chrono-0.4.19\src\sys\windows.rs:127:9
  • test\built-ins\Date\prototype\toString\format.js
thread 'main' panicked at 'SystemTimeToFileTime failed with: The parameter is incorrect. (os error 87)', ...\chrono-0.4.19\src\sys\windows.rs:117:9

Build environment:

  • OS: Windows
  • Version: 10
  • Target triple: x86_64-pc-windows-msvc
  • Rustc version: rustc 1.56.0-nightly (ad02dc46b 2021-08-26)

Additional context

Investigating the origin of the panic I realized the first three tests call either setFullYear or setYear, so that's probably the origin of the panic.

@jedel1043 jedel1043 added bug Something isn't working builtins PRs and Issues related to builtins/intrinsics windows Issues and PRs related to the Windows platform. labels Sep 10, 2021
@hle0
Copy link
Contributor

hle0 commented Oct 4, 2021

I can confirm this still happens in the latest version.

The line of code that triggers the panic seems to be an unsafe call in chrono:

call!(TzSpecificLocalTimeToSystemTime(0 as *mut _, &mut sys_time, &mut utc));

Here's the full trace.

thread 'main' panicked at 'TzSpecificLocalTimeToSystemTime failed with: The parameter is incorrect. (os error 87)', C:\Users\henry\.cargo\registry\src\github.com-1ecc6299db9ec823\chrono-0.4.19\src\sys\windows.rs:127:9
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\/library\std\src\panicking.rs:515
   1: std::panicking::begin_panic_fmt
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\/library\std\src\panicking.rs:457
   2: chrono::sys::inner::local_tm_to_time
             at C:\Users\henry\.cargo\registry\src\github.com-1ecc6299db9ec823\chrono-0.4.19\src\sys\windows.rs:127
   3: chrono::sys::Tm::to_timespec
             at C:\Users\henry\.cargo\registry\src\github.com-1ecc6299db9ec823\chrono-0.4.19\src\sys.rs:122
   4: chrono::offset::local::datetime_to_timespec
             at C:\Users\henry\.cargo\registry\src\github.com-1ecc6299db9ec823\chrono-0.4.19\src\offset\local.rs:73
   5: chrono::offset::local::impl$1::from_local_datetime
             at C:\Users\henry\.cargo\registry\src\github.com-1ecc6299db9ec823\chrono-0.4.19\src\offset\local.rs:161
   6: boa::builtins::date::impl$4::set_components::closure$2::closure$8
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\builtins\date\mod.rs:319
   7: enum$<core::option::Option<chrono::naive::datetime::NaiveDateTime> >::and_then<chrono::naive::datetime::NaiveDateTime,chrono::naive::datetime::NaiveDateTime,boa::builtins::date::impl$4::set_components::closure$2::closure$8>
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\library\core\src\option.rs:1030
   8: boa::builtins::date::impl$4::set_components::closure$2
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\builtins\date\mod.rs:313
   9: enum$<core::option::Option<chrono::naive::datetime::NaiveDateTime> >::and_then<chrono::naive::datetime::NaiveDateTime,chrono::naive::datetime::NaiveDateTime,boa::builtins::date::impl$4::set_components::closure$2>
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\library\core\src\option.rs:1030
  10: boa::builtins::date::Date::set_components
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\builtins\date\mod.rs:290
  11: boa::builtins::date::Date::set_year
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\builtins\date\mod.rs:1221
  12: boa::object::gcobject::JsObject::call_construct
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\object\gcobject.rs:321
  13: boa::object::gcobject::JsObject::call
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\object\operations.rs:297
  14: boa::context::Context::call
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\context.rs:397
  15: boa::syntax::ast::node::call::impl$1::run
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\syntax\ast\node\call\mod.rs:113
  16: boa::syntax::ast::node::impl$3::run
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\syntax\ast\node\mod.rs:316
  17: boa::syntax::ast::node::statement_list::impl$1::run
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\syntax\ast\node\statement_list\mod.rs:152
  18: boa::context::Context::eval<ref$<alloc::vec::Vec<u8,alloc::alloc::Global> > >
             at C:\Users\henry\Documents\boa-master\boa-master\boa\src\context.rs:859
  19: boa::main
             at .\src\main.rs:163
  20: core::ops::function::FnOnce::call_once<enum$<core::result::Result<tuple$<>,std::io::error::Error>, 0, 3, Err> (*)(),tuple$<> >
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b\library\core\src\ops\function.rs:227

I'll continue to investigate.

@Razican
Copy link
Member

Razican commented Jan 31, 2022

@hle0 do you have any updates in the progress of this?

@Razican Razican unassigned hle0 Sep 7, 2022
@Razican Razican added the help wanted Extra attention is needed label Oct 21, 2022
@nekevss
Copy link
Member

nekevss commented Mar 21, 2023

I believe the panics should be addressed with whichever new release of chrono with this pr. 😄 I'll run the suite locally when chrono is updated to confirm.

@jedel1043
Copy link
Member Author

Maybe addressed by #3595? Needs confirmation.

@nekevss
Copy link
Member

nekevss commented Apr 12, 2024

Oh yeah, this should be addressed by that PR. chrono was the source of the panics, so removing it as a dependency would fix this.

@jedel1043
Copy link
Member Author

Works now using the time crate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working builtins PRs and Issues related to builtins/intrinsics help wanted Extra attention is needed windows Issues and PRs related to the Windows platform.
Projects
Status: Done
Development

No branches or pull requests

4 participants