1
Code:
In function int process_cmd(json_item *ijson, struct _cmd_process *pc,
subuser **iuser, acetables *g_ape)
shutdown(retval.client_close->fd, 2);
Bug:
If there are many online users ,and CPU is heavy burden, an user may
timeout and call void deluser(USERS *user, acetables *g_ape) to free
subusers , if ape_disconnect for retval.client_close is called after
deluser , the line:
if (((subuser *)(co->attach))->wait_for_free == 1)
in void ape_disconnect(ape_socket *co, acetables *g_ape) will access
a freed memory ,or crash...
Solution:
solution is keep only one pointer for subuser in _ape_socket
int process_cmd(json_item *ijson, struct _cmd_process *pc, subuser
**iuser, acetables *g_ape)
...
shutdown(retval.client_close->fd, 2);
//add line
g_ape->co[retval.client_close->fd]->attach=NULL;
...
2
Code:
void do_died(subuser *sub) function is used to shutdown client fd and
use ape_disconnect to free subuser struct,but if user timeout before
ape_disconnect called, function void delsubuser(subuser **current,
acetables *g_ape) will call free(del) to free subuser,the after
calling of ape_disconnect will also free subuser and crash will occur.
Solution:
do_died don't set ADIED flag
void do_died(subuser *sub)
...
sub->state = 2;
...
void delsubuser(subuser **current, acetables *g_ape)
...
if (del->state == ALIVE) {
del->wait_for_free = 1;
do_died(del);
}
else
if(del->state != 2)
{
free(del);
}
...
3
Code:
void deluser(USERS *user, acetables *g_ape) will free user, and cause
ape_disconnect to free subuser after.
static void ape_disconnect(ape_socket *co, acetables *g_ape)
...
if (((subuser *)(co->attach))->user->istmp) { <====will access a
freed ((subuser *)(co->attach))->user
So I remove the code.
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/