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

请求偶尔会报这个错误 Cannot read property 'send' of undefined #4724

Open
tomDogwow opened this issue Jul 23, 2021 · 3 comments
Open

Comments

@tomDogwow
Copy link

[2021-07-23 16:35:19.137] [cfork:master:28480] worker:23272 exit (code: null, exitedAfterDisconnect: true, state: dead, isDead: true, isExpected: true, worker.disableRefork: false)
[2021-07-23 16:35:19.754] [cfork:master:28480] master uncaughtException: TypeError: Cannot read property 'send' of undefined
at Server. (D:\A-EGG\node_modules_egg-cluster@1.27.0@egg-cluster\lib\master.js:219:16)
at Server.emit (events.js:310:20)
at TCP.onconnection (net.js:1558:8)
TypeError: Cannot read property 'send' of undefined
at Server. (D:\A-EGG\node_modules_egg-cluster@1.27.0@egg-cluster\lib\master.js:219:16)
at Server.emit (events.js:310:20)
at TCP.onconnection (net.js:1558:8)

@egg-bot
Copy link

egg-bot commented Jul 23, 2021

Hello @tomDogwow. Please provide a reproducible example following the instruction.

Issues labeled by Need Reproduce will be closed if no activities in 7 days.


@tomDogwow,请根据这个说明提供最小可复现代码。

如果在 7 天内没有进展会被自动关闭。

@atian25
Copy link
Member

atian25 commented Jul 23, 2021

需提供复现方式,从报错来看,eggjs/egg-cluster@c683b67

@tomDogwow
Copy link
Author

需提供复现方式,从报错来看,eggjs/egg-cluster@c683b67

哎 不是百分百出这问题的;
今天中午的时候频繁出现这种情况,因为是开发环境下 每次都需要重启一下或者在代码里敲几下回车在保存才能好,刚刚尝试了半天都没有在出现过这情况,

就只有下面这一个接口爆了好几次这错误;
`async order() {

    let query = this.ctx.query;
    let payTime = Math.round(new Date() / 1000);
    var type;
    query.type == 'wechat' ? type = 1 : type = 2;
    let product = query.product;
    if (product == 1 || product == 10 || product == 20 || product == 50) {
        console.log("")
    } else {
        return this.ctx.body = { msg: 'error' }
    };

    let price = query.price
    let param = this.app.jwt.sign(payTime, this.app.config.secret); 
    let sign = '43cc782030f4cfbfc29e2b8b5';

    let sign = md5(payTime + param + type + price + sign);
    let notifyUrl = 'http://xxxx/vpay/paynotify'
    let option = {
        payId: payTime,
        type: type,
        price: price,
        sign: sign,
        param: param,
        notifyUrl: notifyUrl
    }
    let url = `http://xxxx/createOrder`
    try {
        var res = await this.ctx.curl(url, {
            method: 'POST',
            dataType: 'json',
            timeout: 5500,
            data: option
        });
    } catch (error) {
        var err = error;
        console.log('err', err)
        this.ctx.status = 500
        return this.ctx.body = { code: -1, msg: '系统出错,请稍后再试!' }
    };
    console.log(res)
    if (res.data.code === -1) {
        this.ctx.status = 201
        return this.ctx.body = { code: -1, msg: '订单创建失败' }
    }
    let time = dayjs(res.data.date);
    let imgUrl = res.data.data.payUrl
    let timeEnd = time.add(res.data.data.timeOut, 'minute').format('YYYY-MM-DD HH:mm:ss')
    let result = {
        orderid: res.data.data.orderId,
        imgUrl: imgUrl,
        createTime: time.format('YYYY-MM-DD HH:mm:ss'),
        timeOut: timeEnd,
        isAuto: res.data.data.isAuto,
        reallyPrice: res.data.data.reallyPrice
    }
    return this.ctx.body = result
}

`

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

No branches or pull requests

3 participants