badmsg contents

I’m trying to debug a IPC client application that is causing tick.q tothrow 'badmsg. On the wiki, I see an old reference to a ".z.bm"function that is called when a malformed data structure is received andsets the “msg” global variable with the contents of the message.However, I don’t see “.z.bm” or “msg” defined. Does this function stillexist?Josh

you need to define .z.bm yourself

IPC Message Validator

Previous versions of kdb+ were sensitive to being fed malformed data structures, sometimes resulting in a crash. kdb+ 2.7 validates incoming ipc messages to check that data structures are well formed, reporting 'badMsg and disconnecting senders of malformed data structures. The raw message is captured for analysis via the callback .z.bm. The sequence upon receiving such a message is

  1. calls .z.bm with a single arg, a list of (handle;msgBytes)
  2. close the handle and call .z.pc
  3. throws 'badmsg

e.g. with the callback defined

.z.bm:{`msg set (.z.p;x);}

then after a bad msg has been received, the global var msg will contain the timestamp, the handle and the full message. Note that this check validates only the data structures, it cannot validate the data itself.