nanomsg / nng

nanomsg-next-generation -- light-weight brokerless messaging
https://nng.nanomsg.org
MIT License
3.84k stars 492 forks source link

websocket transport use nng_stream will cause crashed #1708

Closed alawn-wang closed 11 months ago

alawn-wang commented 11 months ago

Describe the bug when use 'nng_stream_send' send data when do pressure test(send data frequently), it will crashed. I use another repo('https://github.com/robiwano/siesta') to create a websocket server and communicate with client. In 'siesta' examples/web_socket_client.cpp and web_socket_server.cpp.

Expected behavior It will continious receive and send data.

Actual Behavior There is a nni_panic 'panic: appending node already on a list or not inited'

To Reproduce https://github.com/robiwano/siesta/blob/master/examples/web_socket_client.cpp https://github.com/robiwano/siesta/blob/master/examples/web_socket_server.cpp

Environment Details

gdamore commented 11 months ago

Well, I am not sure about the siesta code.. it appears to use NNG, but I really would not like to debug that project.

When that panic comes about, it usually means someone is trying to submit a second operation on an AIO.

Otherwise I'd need more detail (in the form a stack backtrace perhaps) to say more.

gdamore commented 11 months ago

What I would suggest is file the bug against siesta, and then if the author there has evidence that there is an NNG bug here, they can contact me with specifics (including why they believe that and a bit more detail).

alawn-wang commented 11 months ago

Well, I am not sure about the siesta code.. it appears to use NNG, but I really would not like to debug that project.

When that panic comes about, it usually means someone is trying to submit a second operation on an AIO.

Otherwise I'd need more detail (in the form a stack backtrace perhaps) to say more.

THX for your reply and suggustion of bugging. I'am try to do it. I will close this issue before I find more details

alawn-wang commented 11 months ago

Hi, Dear gdamore, seem I found the reason why i will crash, but I should to confirm with you. I band two nng_aio(one for receive and another for send) with a stream for a client. the server do a simple thing, receive data from client and then send it back as is. the client continiously send 5 messages, the server block when receive the first message when all message was sent, i let the server run, it bug occurs. So it is because 'a_inputs'&'a_outputs' just have 4 capacity? and the aio was be cancelled?

alawn-wang commented 11 months ago

What I would suggest is file the bug against siesta, and then if the author there has evidence that there is an NNG bug here, they can contact me with specifics (including why they believe that and a bit more detail).

BTW, I want to know if there is anyway to solve this problem?