Skip to content

Cannot read property 'Symbol(type)' of undefined #24546

Closed
@davedoesdev

Description

@davedoesdev

Sample program:

const { createServer, connect } = require('http2');
createServer().listen(7000, () => {
    connect('http://localhost:7000', session => {
        session.request({ ':method': 'POST' }).end(() => {
            session.destroy();
        });
    });
});

Exception:

internal/http2/core.js:2009
          this[kSession][kType] === NGHTTP2_SESSION_SERVER &&
                        ^

TypeError: Cannot read property 'Symbol(type)' of undefined
    at ClientHttp2Stream.[kMaybeDestroy] (internal/http2/core.js:2009:25)
    at ShutdownWrap.afterShutdown [as oncomplete] (internal/http2/core.js:1547:26)
    at ClientHttp2Stream._final (internal/http2/core.js:1841:14)
    at callFinal (_stream_writable.js:617:10)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)

Cause is destroy() happening (and setting [kSession] to undefined) before afterShutdown then calls [kMaybeDestroy]().

The example shows a simple repro but if timing is wrong then it can also 'just happen' (session is destroyed while stream is shutting down.

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