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

NPE in FileSystemInfo #14028

Closed
HitkoDev opened this issue Aug 19, 2021 · 7 comments · Fixed by #14030
Closed

NPE in FileSystemInfo #14028

HitkoDev opened this issue Aug 19, 2021 · 7 comments · Fixed by #14030

Comments

@HitkoDev
Copy link

HitkoDev commented Aug 19, 2021

Bug report

What is the current behavior?

Null pointer error Error due to null object in FileSystemInfo.getContextTimestamp

If the current behavior is a bug, please provide the steps to reproduce.

Call FileSystemInfo.getContextTimestamp with an immutable path (immutable path prefixes are provided in FileSystemInfo constructor).

What is the expected behavior?

_readContextTimestamp (processor for contextTimestampQueue) returns null for immutable paths:

webpack/lib/FileSystemInfo.js

Lines 3016 to 3020 in bd7cb37

_readContextTimestamp(path, callback) {
this._readContext(
{
path,
fromImmutablePath: () => null,

so the queue callback in getContextTimestamp should handle entry possibly being null:

webpack/lib/FileSystemInfo.js

Lines 1164 to 1168 in bd7cb37

this.contextTimestampQueue.add(path, (err, entry) => {
const resolved = getResolvedTimestamp(entry);
if (resolved !== undefined) return callback(null, resolved);
this._resolveContextTimestamp(entry, callback);
});

Other relevant information:
webpack version: 5.51.0
Node.js version: all
Operating System: all
Additional tools: N/A

@HitkoDev
Copy link
Author

Related: #14019

@alexander-akait
Copy link
Member

What is Null pointer? It is not Java

@HitkoDev
Copy link
Author

HitkoDev commented Aug 19, 2021

What is Null pointer? It is not Java

True, JavaScript has "nullable types" instead of "null pointers", and typeof null === "object", so technically I should say "null object error" (NOE) or "error due to null object" (EDTNO). But perhaps enough nitpicking, let's focus on the fact that callback receives null and doesn't handle it.

@kandangit
Copy link

kandangit commented Aug 19, 2021

I also have this problem

FileSystemInfo.js:816
        if (entry.resolved !== undefined) return entry.resolved;
                 ^

TypeError: Cannot read property 'resolved' of null

This looks like a recent webpack update (webpack is imported as a transitive dependency in my Node project).

Version 5.51.0 gives the issue. I have resolved by importing a previous dependency directly:

"webpack": "5.45.1"

@HitkoDev
Copy link
Author

HitkoDev commented Aug 19, 2021

This looks like a recent webpack update. (use webpack as a transitive dependency in my Node project).

It appeared in 5.51.0, so just downgrade to 5.50.0 for now.

@sokra
Copy link
Member

sokra commented Aug 19, 2021

Yep that is a bug. Could one of you give me a stack trace of that?

@HitkoDev
Copy link
Author

Yep that is a bug. Could one of you give me a stack trace of that?

TypeError: Cannot read property 'resolved' of null
    at getResolvedTimestamp (node_modules/webpack/lib/FileSystemInfo.js:816:12)
    at node_modules/webpack/lib/FileSystemInfo.js:1165:21
    at node_modules/webpack/lib/util/AsyncQueue.js:352:5
    at Hook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (node_modules/tapable/lib/Hook.js:18:14)
    at AsyncQueue._handleResult (node_modules/webpack/lib/util/AsyncQueue.js:322:21)
    at node_modules/webpack/lib/util/AsyncQueue.js:305:11
    at node_modules/webpack/lib/FileSystemInfo.js:3100:5
    at Array.<anonymous> (node_modules/webpack/lib/FileSystemInfo.js:2960:13)
    at runCallbacks (node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:27:15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants