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

信道接收顺序错乱问题 #38

Open
chn-lee-yumi opened this issue Feb 16, 2018 · 10 comments
Open

信道接收顺序错乱问题 #38

chn-lee-yumi opened this issue Feb 16, 2018 · 10 comments

Comments

@chn-lee-yumi
Copy link

按照我写的服务端代码逻辑,
首先tunnel.broadcast消息A,然后tunnel.broadcast消息B。
在客户端上正常应该先收到A,然后才收到B,但是有时候会先收到B,再收到A。
这种情况怎么处理?

@jas0ncn
Copy link

jas0ncn commented Feb 17, 2018

能否贴一下代码看看呢?

@chn-lee-yumi
Copy link
Author

chn-lee-yumi commented Feb 17, 2018

服务端代码:
发送20条信息。
qq 20180217013950
客户端接收到11条错乱的信息,丢了9条。
qq 20180217014325
@jas0ncn

@jas0ncn
Copy link

jas0ncn commented Feb 17, 2018

额,tunnel.broadcast 是异步的操作,循环一个异步的操作不代表会按顺序,这是异步的特性。建议使用队列。

@chn-lee-yumi
Copy link
Author

请问有提供相关的函数吗?服务端发送消息我只看到有broadcast
@jas0ncn

@chn-lee-yumi
Copy link
Author

chn-lee-yumi commented Feb 18, 2018

我用async实现了顺序执行,不过还是会出现丢包的现象
下面是服务端的代码:
0
1
2
下面是客户端接收到的信息:
3
测试了5次,100条信息,丢了15条。

@jas0ncn
Copy link

jas0ncn commented Feb 18, 2018

方便把服务端broadcast之后的返回打印出来吗?打印出来看一下返回的结果是什么

@chn-lee-yumi
Copy link
Author

下面是服务端的代码:
qq 20180218233503
qq 20180218233522
下面是客户端收到的信息:
qq 20180218233436
@jas0ncn

@jas0ncn
Copy link

jas0ncn commented Feb 21, 2018

SDK会把Log打出来:
https://github.com/tencentyun/wafer2-node-sdk/blob/2084c4d9839509a1e60eafc4d41c16cc5c5e62d3/lib/tunnel/api.js#L55

可以到腾讯云控制台下载日志:
image

看看日志输出的message是什么

@chn-lee-yumi
Copy link
Author

原来可以从这里下log……
下面是log内容:
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 10): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 11): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 12): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 13): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 14): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 15): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 16): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 17): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 18): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 20): Error: Request failed with status code 502
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 21): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 22): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 23): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 24): Error: ERR_REMOTE_TUNNEL_SERVER_RESPONSE
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 25): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 26): Error: ERR_UNKNOWN_TUNNEL_ERROR
(node:9200) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 27): Error: ERR_UNKNOWN_TUNNEL_ERROR
@jas0ncn

@jas0ncn
Copy link

jas0ncn commented Feb 28, 2018

这个我们再排查一下

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

2 participants