lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Well, I found the problem. It was enet trying to free some memory that didn't belong to it and me being silly and using a start-at-one for loop and not a start-at-zero one when copying data to the packet.

On Mon, Apr 23, 2012 at 8:24 PM, Alex <initrd.gz@gmail.com> wrote:
I'm writing a client/server pair in LuaJIT + ffi + enet in Windows 7 and am running into some issues which I cannot seem to pinpoint. Shortly after sending a packet from server to client, I'm faced with weird out-of-memory errors and stalls. Additionally, even though I have both enet and LuaJIT compiled with debug symbols, when I run GDB on it, I get this oddity:

(gdb) set debug jit 1
(gdb) target exec luajit.exe
jit_inferior_init
(gdb) run src/main_server.lua
jit_inferior_init
Starting program: c:\...\luajit.exe src/main_server.lua
[New Thread 224.0x11c8]
jit_inferior_init
jit_inferior_init, descriptor_addr = 0x66dd1004
jit_breakpoint_re_set_internal, breakpoint_addr = 0x66db2120
jit_inferior_init
jit_inferior_init
jit_inferior_init, descriptor_addr = 0x66dd1004
jit_breakpoint_re_set_internal, breakpoint_addr = 0x66db2120
jit_inferior_init, descriptor_addr = 0x66dd1004
... some server output ...
04/23/12 20:22:16 Info - main: Server starting, press 'q' to stop.
jit_register_code, symfile_addr = 0x3802f4, symfile_size = 3109556322304
04/23/12 20:22:26 Info - server: 127.0.0.1 connecting
... some more server loading / output ...
jit_register_code, symfile_addr = 0x39bcec, symfile_size = 3092376453120
jit_register_code, symfile_addr = 0x36f704, symfile_size = 3126739678536
jit_register_code, symfile_addr = 0x3548bc, symfile_size = 3161099416904
jit_register_code, symfile_addr = 0x36a324, symfile_size = 3109559809352
jit_register_code, symfile_addr = 0x3452c4, symfile_size = 3092379940168
04/23/12 20:22:26 Debug - server: Sending data to 127.0.0.1
04/23/12 20:22:26 Debug - server: Data sent
warning: HEAP[luajit.exe]:
warning: Heap block at 003ABBF8 modified at 003ABC6E past requested size of 6e


Program received signal SIGTRAP, Trace/breakpoint trap.
0x776204e5 in ntdll!TpWaitForAlpcCompletion () from C:\windows\system32\ntdll.dll
(gdb) backtrace
#0  0x776204e5 in ntdll!TpWaitForAlpcCompletion () from C:\windows\system32\ntdll.dll
#1  0x0028f900 in ?? ()
#2  0x77605732 in ntdll!RtlLargeIntegerDivide () from C:\windows\system32\ntdll.dll
#3  0x003abbf8 in ?? ()
#4  0x775e29fa in ntdll!RtlCopyExtendedContext () from C:\windows\system32\ntdll.dll
#5  0x00000000 in ?? ()
(gdb) kill
Kill the program being debugged? (y or n) y
jit_inferior_init
jit_inferior_init
jit_inferior_init, descriptor_addr = 0x66dd1004
jit_breakpoint_re_set_internal, breakpoint_addr = 0x66db2120
jit_inferior_init, descriptor_addr = 0x66dd1004
(gdb) quit


I'm not quite sure if this is an error inside of enet or my ffi code, and every time I debug LuaJIT in GDB I always get these unhelpful backtraces. How would I get some useful info about where this issue is occurring, aside from adding print()s everywhere?

Thanks, Alex.