Error RpcIpcMessagePortClosedError

See original GitHub issue

Current behavior

I stumbled upon an issue when running an editor Zettlr (https://github.com/Zettlr/Zettlr) and the issue seems to originate from fork-ts-checker-webpack-plugin module. This issue might be similar to https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/issues/562, however the steps to reproduce are different. Error message:

node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 4492.
    at /home/peter/code/Zettlr-3/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:47:47
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: undefined,
  signal: undefined
}

Expected behavior

Instead of Zettlr starting normally, the error message is displayed and Zettlr either fails to start or starts with a blank window.

Steps to reproduce the issue

mkdir Zettlr
git clone https://github.com/Zettlr/Zettlr.git Zettlr
cd Zettlr
yarn install --frozen-lockfile
yarn test-gui --clean --clear-cache

By default fork-ts-checker-webpack-plugin version 6.2.10 is installed. Above steps produce the error message shown above. The program then exists without starting the GUI of Zettlr or the Zettlr starts with a blank window. Several instances of this message appear each with a different process ID and the number of messages corresponds to the number of (virtual) CPU cores.

If I downgrade to fork-ts-checker-webpack-plugin version 6.2.2 with:

yarn add fork-ts-checker-webpack-plugin@6.2.2

and run Zettlr with the same command:

yarn test-gui --clean --clear-cache

the error doesn’t appear and Zettlr starts normally. I tried other version (6.2.3, 6.2.4 and 6.2.5) and sometimes it works (Zettlr starts without any error), sometimes it doesn’t (the above error is displayed).

I tested this on freshly installed Xubuntu in virtual machine and with the develop branch of Zettlr from github repo.

Issue reproduction repository

https://github.com/Zettlr/Zettlr, develop branch

Environment

  • fork-ts-checker-webpack-plugin: 6.2.10
  • typescript: 4.3.2
  • eslint: 7.28.0
  • webpack: 5.38.1
  • os: Xubuntu 21.04 in the virtual machine

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
oliverlorenzcommented, Oct 12, 2021

I have a similar problem I want to share. Maybe its helpful to figure out what is the problem is. For this I will provide my setup here.

I came here from usage of nx running a node application. For development setup we run npm start (translates to) nx serve --runtimeArgs=--max-old-space-size=8192 --verbose which is doing a hot reload. I also added a DEBUG=* hoping to see something. Output is:

> nx run partner-api:serve --runtimeArgs=--max-old-space-size=2048 --verbose 
Hash: 816d7473c52e876f651b
Version: webpack 4.46.0
Built at: 10/12/2021 8:56:27 AM
              Asset      Size  Chunks                   Chunk Names
    assets/.gitkeep   0 bytes          [emitted]        
assets/swagger.json  1.61 KiB          [emitted]        
            main.js  25.2 KiB    main  [emitted]        main
        main.js.map  23.5 KiB    main  [emitted] [dev]  main
Entrypoint main = main.js main.js.map
Issues checking in progress...
  express:application set "x-powered-by" to true +0ms
  express:application set "etag" to 'weak' +2ms
  express:application set "etag fn" to [Function: generateETag] +0ms
  express:application set "env" to 'development' +1ms
  express:application set "query parser" to 'extended' +0ms
  express:application set "query parser fn" to [Function: parseExtendedQueryString] +0ms
  express:application set "subdomain offset" to 2 +0ms
  express:application set "trust proxy" to false +0ms
  express:application set "trust proxy fn" to [Function: trustNone] +1ms
  express:application booting in development mode +0ms
  express:application set "view" to [Function: View] +0ms
  express:application set "views" to '/app/views' +0ms
  express:application set "jsonp callback name" to 'callback' +0ms
  express:router use '/' query +1ms
  express:router:layer new '/' +0ms
  express:router use '/' expressInit +0ms
  express:router:layer new '/' +1ms
  express:router use '/' urlencodedParser +0ms
  express:router:layer new '/' +0ms
  express:router use '/' jsonParser +0ms
  express:router:layer new '/' +0ms
  express:router use '/docs' swaggerInitFn +1ms
  express:router:layer new '/docs' +0ms
  express:router use '/docs' serveStatic +0ms
  express:router:layer new '/docs' +0ms
  express:router use '/docs' <anonymous> +0ms
  express:router:layer new '/docs' +0ms
  express:router use '/swagger.json' serveStatic +0ms
  express:router:layer new '/swagger.json' +0ms
  express:router:route new '/partner/partner/:userId' +0ms
  express:router:layer new '/partner/partner/:userId' +1ms
  express:router:route get '/partner/partner/:userId' +0ms
  express:router:layer new '/' +0ms
Listening at http://localhost:3000/
No issues found.
Hash: 816d7473c52e876f651b
Version: webpack 4.46.0
Built at: 10/12/2021 8:56:47 AM
              Asset      Size  Chunks             Chunk Names
    assets/.gitkeep   0 bytes          [emitted]  
assets/swagger.json  1.61 KiB          [emitted]  
 + 2 hidden assets
Entrypoint main = main.js main.js.map

———————————————————————————————————————————————

here I changed a file and saved it.

>  NX   ERROR  Running target "partner-api:serve" failed

  Failed tasks:
  
  - partner-api:serve
  
  Hint: run the command with --verbose for more details.

node@774fa312c94c:/app$ node:internal/process/promises:246
          triggerUncaughtException(err, true /* fromPromise */);
          ^

RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 98.
    at /app/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/RpcIpcMessagePort.js:47:47
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: undefined,
  signal: undefined
}

The whole process is running in a docker container. Dockerfile.development:

FROM node:16-slim
RUN apt-get update && \
    apt-get install -y git && \
    rm -rf /var/lib/apt/lists/*

# build args (optional to change)
ARG UID=1000
ARG GID=1000
ARG USERNAME=node

# permissions
RUN mkdir /app
RUN mkdir /.npm
RUN chown node:node /app
WORKDIR /app
USER node

EXPOSE 3000
CMD npm start

docker_compose.yml

version: "3.9"
services:
  partnerapi:
    build:
      context: .
      dockerfile: Dockerfile.development
    user: "${DOCKER_UID:-node}:${DOCKER_GID:-node}"
    ports:
      - "3000:3000"
      - "9229:9229"
    networks: [a_network]
    volumes:
      - "../partnerapi:/app"

command to start:

DOCKER_UID=$(id -u) DOCKER_GID=$(id -g) docker-compose up partnerapi

My current “fix” is to add the restart: unless-stopped flag to the docker-compose, so at least it restarts after the crash.

My current assumption is, that there is a restriction in the IPC inside the docker (this is wild guess!). But maybe somebody with a deeper knowledge about this can see some connection I miss here.

Last note: The Issue disappears if the nx process is not running inside a docker container.

1reaction
waterfallpitcommented, Jun 18, 2021

Thank you for the reply. I was testing it some more this afternoon and figured out I underestimated memory usage. Increasing RAM for the said virtual machine past 4 GB and increasing the swapfile helped and I am not getting this error any more. I apologize for opening the issue, since it is clear now, after solving the issue, that the problem was in my environement and not in the fork-ts-checker-webpack-plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio IDE RpcIpcMessagePortClosedError: Cannot ...
I solved the problem by closing the visual studio code windows that I used to examine other project code. It worked then, but...
Read more >
cannot send the message | The AI Search Engine You Control
Visual Studio IDE RpcIpcMessagePortClosedError: Cannot send the message - the message port has been closed for the process 18182.
Read more >
fork-ts-checker-webpack-plugin - npm
Runs typescript type checker and linter on separate process.. Latest version: 7.2.14, last published: 11 days ago.
Read more >
of /store/node_modules/fork-ts-checker-webpack-plugin/lib/rpc ...
Index of /store/node_modules/fork-ts-checker-webpack-plugin/lib/rpc/rpc-ipc/error/ ../ RpcIpcMessagePortClosedError.d.ts 26-Oct-1985 08:15 423 ...
Read more >
"The NPM script 'start' exited without indicating that the create ...
Net React Application. When I try to run my project I always get this error: 181477-image.png. I' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found