Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[BUG] Cluster worker message listener registration failure with ESM files extension

Đang mở
#782 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@jerome-benoit đang làm issue này rồi.

Từ ngày 27/6/2023.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug

Describe the bug

Messages sent from main thread with worker.send() are not handled worker side by the message handler registered with
cluster.worker.on('message', (msg) => ...) if implemented with ESM.

Since the primary usage of cluster pool is stateless network services, not being able to submit a task to it does not hinder that usage with ESM files extension.

The investigation needs the ensure the issue is not related to a node.js version.

Tests shall be added to ensure the internal IPC used on each pool type works by using ESM files extension.

Steps to reproduce the behavior

Submit a task to a cluster pool by using ESM files extension.

Expected behavior

Cluster pool tasks execution shall work by using ESM files extension.

Info

Tool Version
Poolifier v2.6.x
Node v20.3.1
OS win,linux,mac

Additional context

Code triggering the issue to put in benchmarks/internal and run from the repository root after pnpm build: node benchmarks/internal/{filename}.mjs

import { WorkerChoiceStrategies } from '../../lib/index.mjs'
import {
  PoolTypes,
  WorkerFunctions,
  WorkerTypes
} from '../benchmarks-types.mjs'
import { buildPool, runTest } from '../benchmarks-utils.mjs'

const poolSize = 30
const taskExecutions = 1
const workerData = {
  function: WorkerFunctions.jsonIntegerSerialization,
  taskSize: 1000
}
const workerChoiceStrategyRoundRobinPoolOption = {
  workerChoiceStrategy: WorkerChoiceStrategies.ROUND_ROBIN
}

// const fixedThreadPoolRoundRobin = buildPool(
//   WorkerTypes.thread,
//   PoolTypes.fixed,
//   poolSize,
//   workerChoiceStrategyRoundRobinPoolOption
// )

const fixedClusterPoolRoundRobin = buildPool(
  WorkerTypes.cluster,
  PoolTypes.fixed,
  poolSize,
  workerChoiceStrategyRoundRobinPoolOption
)

// await runTest(fixedThreadPoolRoundRobin, {
//   taskExecutions,
//   workerData
// })

await runTest(fixedClusterPoolRoundRobin, {
  taskExecutions,
  workerData
})
Ngôn ngữ chính
JavaScript
Star
454
Fork
17
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
27

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của poolifier/poolifier

Tất cả issue của poolifier/poolifier

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.