Showing results for 
Search instead for 
Did you mean: 

badmsg contents

New Contributor
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 ""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 "" or "msg" defined. Does this function stillexist?Josh

New Contributor II
New Contributor II
you need to define 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 The sequence upon receiving such a message is

1) calls 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{`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.