eggjs / eggjs/egg

egg-mock: 当app在beforeClose时使用ipc 警告channel closed

Open
#3,613 0 comments 0 reactions 2 assignees Claimed by @popomore View on GitHub
Inactive maybe-bug
Dominant language
TypeScript
Stars
19k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

## What happens?
1.app.js 在 beforeClose 中使用ipc广播
2.mock使用cluster启动
3.当app关闭时会触发一个channel closed的警告

不清楚是否是因为进程关闭顺序有问题。

## Mini Showcase Repository(REQUIRED)

https://github.com/XueRainey/egg-mock-bug.git

## How To Reproduce

**Steps to reproduce the behavior:**
1. npm i
2. npm run test

将会触发如下警告
[Thu Apr 11 2019 15:14:12 GMT+0800 (GMT+08:00)][sendmessage] WARN pid#55871 channel closed, nothing send
stack: Error: channel closed
at send (/Users/rainey/Code/github/egg-mock-bug/node_modules/sendmessage/index.js:44:13)
at Messenger.send (/Users/rainey/Code/github/egg-mock-bug/node_modules/egg/lib/core/messenger/ipc.js:104:5)
at Messenger.sendToApp (/Users/rainey/Code/github/egg-mock-bug/node_modules/egg/lib/core/messenger/ipc.js:81:10)
at AppBootHook.beforeClose (/Users/rainey/Code/github/egg-mock-bug/app.js:10:24)
at Object.callFn (/Users/rainey/Code/github/egg-mock-bug/node_modules/egg-core/lib/utils/index.js:44:42)
at Lifecycle.close (/Users/rainey/Code/github/egg-mock-bug/node_modules/egg-core/lib/lifecycle.js:121:19)
at processTicksAndRejections (internal/process/next_tick.js:81:5)

## Context
- **Node Version**: v11.9.0
- **Egg Version**: 2.15.1
- **Platform**: MacOS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.