Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Assertion fails when previous attempt to connect had failed #1386

Open
atuldpatil opened this issue Jul 30, 2014 · 1 comment
Open

Assertion fails when previous attempt to connect had failed #1386

atuldpatil opened this issue Jul 30, 2014 · 1 comment

Comments

@atuldpatil
Copy link

This happened in server code on Windows, when simultaneous connections were made (through simulator) to the server.

When there is error in connection callback (error code -4060 (UV__ENOBUFS)), the next attempt to connect server results in:

Assertion failed: handle->flags & UV_HANDLE_LISTENING, file src\win\tcp.c, line 352

The assertion at line 352 is (in uv_tcp_queue_accept)
assert(handle->flags & UV_HANDLE_LISTENING);

Flag value: handle->flags = 0x00000220

This is stack:
Application.exe!uv_tcp_queue_accept(uv_tcp_s * handle=0x0013fec4, uv_tcp_accept_s * req=0x003eb1b8) Line 352 + 0x21 bytes C
Application.exe!uv_tcp_accept(uv_tcp_s * server=0x0013fec4, uv_tcp_s * client=0x15b49bdc) Line 639 + 0xd bytes C
Application.exe!uv_accept(uv_stream_s * server=0x0013fec4, uv_stream_s * client=0x15b49bdc) Line 55 + 0xd bytes C
Application.exe!on_new_connection(uv_stream_s * server=0x0013fec4, int status=0) Line 1708 + 0xb bytes C++

Saúl Ibarra Corretgé on libuv google group given hint:
When accepting a connection fails, the UV_HANDLE_LISTENING flag is
reset, that's why next attempt blows up the assert.

So as a solution to this, the line that resets UV_HANDLE_LISTENING flag:
https://github.com/joyent/libuv/blob/master/src/win/tcp.c#L1054

should be removed or what? Please suggest.

Thanks!

@saghul
Copy link
Contributor

saghul commented Aug 9, 2014

@atuldpatil thanks for the report. We are a bit busy with the next libuv release. This will be a bugfix, so we can handle it afterwards.

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

No branches or pull requests

2 participants