Skip to content

perf_hooks: histogram.percentile throw Assertion `(percentile) > (0)' failed when param is NaN #36936

@Lxxyx

Description

@Lxxyx
  • Version: 15.4.0
  • Platform: macOS 10.15.7
  • Subsystem: perf_hooks

What steps will reproduce the bug?

const { monitorEventLoopDelay } = require('perf_hooks');
const h = monitorEventLoopDelay({ resolution: 20 });
h.enable();
h.disable();
console.log(h.percentile(NaN));

How often does it reproduce? Is there a required condition?

Everytime.

What is the expected behavior?

throw ERR_INVALID_ARG_VALUE error.

What do you see instead?

> console.log(h.percentile(NaN));
node[9818]: ../src/histogram-inl.h:37:double node::Histogram::Percentile(double): Assertion `(percentile) > (0)' failed.
 1: 0x1012e4da5 node::Abort() (.cold.1) [/usr/local/bin/node]
 2: 0x1000a6239 node::Abort() [/usr/local/bin/node]
 3: 0x1000a60a1 node::Assert(node::AssertionInfo const&) [/usr/local/bin/node]
 4: 0x10010f23f node::performance::(anonymous namespace)::ELDHistogramPercentile(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 5: 0x10025a4e8 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
 6: 0x100259a7c v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 7: 0x1002591a2 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 8: 0x100a7a359 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions