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

UDP服务端运行一会后奔溃 客户端以非常快速度发送数据 #276

Open
laihuawang opened this issue Dec 27, 2023 · 9 comments

Comments

@laihuawang
Copy link

No description provided.

@FunlyDay
Copy link

FunlyDay commented Dec 27, 2023 via email

@ldcsaa
Copy link
Owner

ldcsaa commented Jan 2, 2024

  1. 什么平台
  2. 内存是否耗尽了
  3. 提供测试样例代码

@laihuawang
Copy link
Author

1、
Linux lubancat 4.19.232 #7 SMP Mon Jul 10 16:21:10 CST 2023 aarch64 aarch64 aarch64 GNU/Linux
Ubuntu 22.04.2 LTS
2、内存没有耗尽,也没有泄露,cpu也没有用满

代码就是UDP 服务端的代码

class WZSensorUdpServerListener : public CUdpServerListener
{
private:
    /* 保护工具类*/
    WZProtectHelper *m_protect_base;

public:
    void setWZProtectBase(WZProtectHelper *wz_protect_base)
    {
        this->m_protect_base = wz_protect_base;
    }
    virtual EnHandleResult OnPrepareListen(IUdpServer *pSender, SOCKET soListen) override
    {
        return this->m_protect_base->OnPrepareListen(pSender, soListen);
    }

    virtual EnHandleResult OnAccept(IUdpServer *pSender, CONNID dwConnID, UINT_PTR soClient) override
    {

        return this->m_protect_base->OnAccept(pSender, dwConnID, soClient);
    }

    virtual EnHandleResult OnHandShake(IUdpServer *pSender, CONNID dwConnID) override
    {
        return this->m_protect_base->OnHandShake(pSender, dwConnID);
    }

    virtual EnHandleResult OnReceive(IUdpServer *pSender, CONNID dwConnID, const BYTE *pData, int iLength) override
    {

        return this->m_protect_base->OnReceive(pSender, dwConnID, pData, iLength);
    }

    virtual EnHandleResult OnSend(IUdpServer *pSender, CONNID dwConnID, const BYTE *pData, int iLength) override
    {
        return this->m_protect_base->OnSend(pSender, dwConnID, pData, iLength);
    }

    virtual EnHandleResult OnClose(IUdpServer *pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode) override
    {
        // 重新连接
        
        return this->m_protect_base->OnClose(pSender, dwConnID, enOperation, iErrorCode);
    }

    virtual EnHandleResult OnShutdown(IUdpServer *pSender) override
    {
        return this->m_protect_base->OnShutdown(pSender);
    }
};


		WZSensorUdpServerListener wz_sensor_udp_server_listener;
	 
		CUdpServerPtr sensor_recv_server(&wz_sensor_udp_server_listener);
 
		if (!sensor_recv_server->Start("0.0.0.0", 1600))
		{
			printf("start error\n");
			return -1;
		}

即使WZProtectHelper 的方法直接return 也会崩溃,客户端为其他平台,发送频率1秒10K数据,uint8数组,长度为42

@ldcsaa
Copy link
Owner

ldcsaa commented Jan 3, 2024

你这个是ARM平台吗?

先编译个debug版本,异常时生成core dump,通过dump文件看看异常位置。

@laihuawang
Copy link
Author

image
这种可以吗 另往你gmail发了我的微信号 方便微信沟通处理下吗

@ldcsaa
Copy link
Owner

ldcsaa commented Jan 5, 2024

加入QQ群吧~

@ldcsaa
Copy link
Owner

ldcsaa commented Jan 5, 2024

image 这种可以吗 另往你gmail发了我的微信号 方便微信沟通处理下吗

堆栈信息,代码行号都看不到。

@ldcsaa
Copy link
Owner

ldcsaa commented Jan 27, 2024

试试 dev分支的6.0.1版本,对UDP Server组件作了大量优化。

@ldcsaa
Copy link
Owner

ldcsaa commented Feb 5, 2024

试试6.0.1版本。

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

No branches or pull requests

3 participants