Skip to content

internalModuleStat breaks when invoked too often with path with umlaut #58586

Open
@stefanzugal

Description

@stefanzugal

Version

22.14.0

Platform

Linux p14s 6.11.0-26-generic #26~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 17 19:20:47 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  • Create the following paths:
    • with umlaut: /tmp/söme-päth
    • without umlaut: /tmp/some-path
  • Run the following snippet, passing option --expose-internals to node:
const {internalBinding} = require('internal/test/binding');
const internalFsBinding = internalBinding('fs');
let path = '/tmp/söme-päth';
// path = '/tmp/some-path';

for (let i = 0; i < 10000; i++) {
    const result = internalFsBinding.internalModuleStat(internalFsBinding, path);
    console.log(result);
}

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

Running the snippet, consistently 6265 (+- 5) times 1 is printed (as expected), the remaining time -1 is printed.

What is the expected behavior? Why is that the expected behavior?

As the path exists, the method should consistently return 1.

What do you see instead?

The method internalModuleStat sometimes detects the path, sometimes not.

Additional information

The method internalModuleStat works nicely for paths without umlauts. Also, it seems that debuggin / and or adding additional code changes the results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions