pomelo icon indicating copy to clipboard operation
pomelo copied to clipboard

libpomelo bug

Open demilich opened this issue 13 years ago • 1 comments

When I do not start server side, I use libpomelo client to connect the server. Memory fault is issued.

My libpomelo client code: int login() { // create a client instance. my_client = pc_client_new();

//struct sockaddr_in address;
memset(&address, 0, sizeof(struct sockaddr_in));
address.sin_family = AF_INET;
address.sin_port = htons(3019);
address.sin_addr.s_addr = inet_addr("192.168.188.131");

// try to connect to server.
if(pc_client_connect(my_client, &address)) 
{
    CCLog("fail to connect server.\n");
    pc_client_destroy(my_client);
    return 1;
}

....... Fault is issue when process pc_client_connect(my_client, &address). And following is call stack.

msvcr100d.dll!_free_base(void * pBlock) Line 50 + 0x13 bytes C 07bdf964()
Uncharted.win32.exe!pc__on_tcp_connect(uv_connect_s * req, int status) Line 391 C++ Uncharted.win32.exe!uv_process_tcp_connect_req(uv_loop_s * loop, uv_tcp_s * handle, uv_connect_s * req) Line 1124 + 0x8 bytes C Uncharted.win32.exe!uv_process_reqs(uv_loop_s * loop) Line 164 + 0x34 bytes C Uncharted.win32.exe!uv_run(uv_loop_s * loop, uv_run_mode mode) Line 276 C Uncharted.win32.exe!pc_run(pc_client_s * client) Line 340 + 0x8 bytes C++ Uncharted.win32.exe!pc__worker(void * arg) Line 37 C++ Uncharted.win32.exe!uv__thread_start(void * ctx_v) Line 285 + 0x3 bytes C msvcr100d.dll!_callthreadstartex() Line 314 + 0xf bytes C msvcr100d.dll!_threadstartex(void * ptd) Line 297 C

I remember previous libpomelo do not issue the memory fault but will wait for a very long time ...

Could you please recommand how to handle this kind of fault?

demilich avatar Apr 05 '13 15:04 demilich

I debug in VS2010 and found an memory fault when querying the error message from uv loop. I fix it, but I am not sure it is the cause of this issue.

Please pull the latest code and try it again. :)

changchang avatar Apr 07 '13 08:04 changchang