Well I am just no thorough and you are correct. 

The sending of data over a zmq socket and the conversion of that data from string to protobuf encoded string all occurred in one line. One I added a print statement and then segregated them more cleanly, I can see that it is most certainly the line that converts to protobuf. 

The exact function that fails (on my end, could be deeper within this) is to_pb from here:

https://github.com/argp/bap/blob/master/ocaml/piqi/ast_piqi.ml#L186

In any case, I did a test, and in my first function when to_pb gets called the first time and succeeds, I added an additional call to it... which also succeeded. But then in a subsequent unit test, the one that has been failing, still segfaults. 

If I turn off the tests prior to the segfaulting test, to_pb works in this particular run. But if the tests run before hand, something goes awry between the tests. Is it possible that to_pb is using some shared state between calls?


On Thu, Dec 4, 2014 at 2:36 PM, Anders Peter Fugmann <anders@fugmann.net> wrote:
Sending data over a zmq socket should not cause a segfault.

I suggest that you open an issue on
https://github.com/issuu/ocaml-zmq
with exact details of the segfault and we can take a stab at it.

/Anders


On 04/12/14 17:45, Kenneth Adam Miller wrote:
Actually, I literally just found the location of the error... I'm trying
to send some data from ocaml that is causing ZMQ to segfault...