If max memory is set using -w command line argument and if a bad query is fired which allocates too much memory, KDB is exiting with "-w abort" error.
Is it possible to make KDB just stop executing that query and not kill itself.
At least is there a call back function which kdb will call before killing itself?
Thanks
There is no callback for handling this error unfortunately, nor is it possible to trap -w abort
using protected evaluation. http://code.kx.com/q/ref/errors/#trap
/process 1 (setup workspace/callbacks)
>q -w 1000 -p 4000 -e 1
q)tab:([]sym:30000000?`3;size:30000000?10f;time:30000000?.z.t)
q).z.pg:{0N!(`pg;x);@[value;x;(::)]}
q).z.exit:{'stop}
q).z.pc:{'stop}
/process 2 (issue sync request)
>q
q)(`::4000)"select from tab"
'close
/process 1 (output)
q)(`pg;"select from tab")
-w abort
Instead, you can try to prevent this error. One approach is to define permissions and validate each users request before executing the query.
Please see the following white-paper for details:
http://www.firstderivatives.com/downloads/q_for_gods_july_2013.pdf