Closed randrews closed 13 years ago
Which one crashes the client or the server? Also can you please provide a backtrace. I can not reproduce the crash on Linux and don't have a Mac to test on.
Sorry, should have said that. The client crashes, but it crashes on exit; it sends all the messages just fine. The only stack information I have is that error I pasted in.
Please run the client using gdb to get a backtrace: $ gdb lua (gdb) run client.lua
Not sure how useful this is, but here you go:
ping 1 nil
ping 2 nil
ping 3 nil
ping 4 nil
ping 5 nil
ping 6 nil
ping 7 nil
ping 8 nil
ping 9 nil
ping 10 nil
lua(9081,0x7fff7d9e2960) malloc: *** error for object 0x1000bdc00: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Program received signal SIGABRT, Aborted.
0x00007fff8f991ce2 in __pthread_kill ()
Not much of a stack trace, sorry. :)
Sorry I forgot you will need to use another gdb command to get the backtrace after the crash: $ gdb lua (gdb) run client.lua ------- wait for crash (gdb) thread apply all backtrace ------ that command will display backtrace for all running threads.
How are you compiling lua-zmq? Using LuaRocks or the CMake build?
Can you provide the build output from my lua-zmq and from iamaleskey's version. I think this might be a problem with compiler flags.
Maybe an easier way would be to replace iamaleskey's zmq.c file with src/pre_generated-zmq.nobj.c and use his makefile to build the .so file and see if it still crashes.
Looks like this is a common problem on OSX: http://lua-users.org/lists/lua-l/2009-10/msg00136.html
Did you recently recompile/reinstall Lua?
Also someone on that thread provided this link to pre-compiled Lua binaries: http://pdb.finkproject.org/pdb/package.php/lua51
With what I am reading online about this error it seems to be a problem with how Lua is compiled on OSX, or maybe lua-zmq is being linked to the wrong version of the Lua VM core (liblua.dylib file).
anyways I hope this info helps, let me know how it goes.
Looks like the Lua from MacPorts should also work, since they include some fixes to the lua Makefiles for this issue: http://www.macports.org/ports.php?by=name&substr=lua
I've got a program that uses req / rep sockets that works totally fine with the iamaleskey version, and explodes with a malloc error on this version.
Here's the client:
And the server:
I'm using zmq 2.1.7 on OS X Lion, Lua 5.1.4, and it fails with this: