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

[coredump] close idle connection #63

Closed
hongzhidao opened this issue Nov 20, 2017 · 1 comment
Closed

[coredump] close idle connection #63

hongzhidao opened this issue Nov 20, 2017 · 1 comment
Assignees

Comments

@hongzhidao
Copy link
Contributor

Hi!

A rash happens in close idle connection. The main problem is with nxt_conn_accept function.

  1. Is it better insert the accepted connection into idle_connections after generating next connection?
    `diff -r 411ed164f393 src/nxt_conn_accept.c
    --- a/src/nxt_conn_accept.c Fri Oct 27 11:05:37 2017 +0300
    +++ b/src/nxt_conn_accept.c Mon Nov 20 03:06:11 2017 -0500
    @@ -191,8 +191,6 @@
    nxt_debug(task, "client: %*s",
    c->remote->address_length, nxt_sockaddr_address(c->remote));
  • nxt_queue_insert_head(&task->thread->engine->idle_connections, &c->link);
  • c->read_work_queue = lev->work_queue;
    c->write_work_queue = lev->work_queue;

@@ -214,6 +212,8 @@
nxt_work_queue_add(lev->socket.read_work_queue,
lev->accept, task, lev, next);
}
+

  • nxt_queue_insert_head(&task->thread->engine->idle_connections, &c->link);
    }`

Since nxt_conn_accept_next may close the connection just generated.

  1. The write_state of connection may not be set yet before closed as the previous description.

  2. The engine connections forget to decrease after free connection?
    Maybe it's better to add a handy function nxt_conn_free(task, c);

  3. The way of free connection is different in the controller (mp_destroy) and router (mp_release) ?

Anyway, the main problem is with closing the idle connections.

Thanks.

@hongzhidao
Copy link
Contributor Author

`
diff -r 411ed164f393 src/nxt_queue.h
--- a/src/nxt_queue.h Fri Oct 27 11:05:37 2017 +0300
+++ b/src/nxt_queue.h Mon Nov 20 03:26:29 2017 -0500
@@ -161,6 +161,8 @@
do {
(link)->next->prev = (link)->prev;
(link)->prev->next = (link)->next; \

  •    (link)->prev = (link);                                                \
    
  •    (link)->next = (link);                                                \
    
    } while (0)

#endif
`

It's better to combine nxt_queue_remove and nxt_queue_self.

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