Is there a potential illegal memory access bug inside chat_room.cpp example?
#1016
Closed
ChihHao-Su
started this conversation in
General
Replies: 1 comment 7 replies
-
|
broadcast 需要保证在hander的io线程中执行,它不是线程安全的。 |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
See https://github.com/alibaba/yalantinglibs/blob/main/src/coro_http/examples/chat_room.cpp#L44
It seems that there will be an illegal memory access, if the program runs like below:
co_awaitonauto ec = co_await conn->write_websocket(resp_str);conn, has resumed, and exited becauseconnhas been closedwrite_websocket.connis invalid now, and that will cause a problem.Is this a real problem? Am I wrong?
Beta Was this translation helpful? Give feedback.
All reactions