3

We have a ticker plant and sometimes someone mistakenly runs queries in HDB without a date or in RDB without a time or with some other processing logic which may kill KDB. How can we find and kill the query without restarting KDB instance?

Donald_W
  • 1,773
  • 21
  • 35
user3914448
  • 469
  • 1
  • 11
  • 22

2 Answers2

5

You can set client query time out in your service:

param: '-T '

reference: http://code.kx.com/q4m3/13_Commands_and_System_Variables/#13121-timeout-t

From wiki: The timeout parameter (note upper case) is an int that specifies the number of seconds any call from a client will execute before it is timed out and terminated. The default value is 0 which means no timeout. This parameter corresponds to the command \T.

Ex: start your q process as:

       q -T 40

it will set client query timeout to 40 seconds.

Sean O'Hagan
  • 1,681
  • 8
  • 14
Rahul
  • 3,914
  • 1
  • 14
  • 25
1

As @Rahul says, you can use T for timeout.

If you're on a unix system you can also kill -SIGINT <pid> - which kills the current thread. In multithreaded mode you might get mixed results though.

Manish Patel
  • 4,411
  • 4
  • 25
  • 48
  • Does kdb query gets a separate thread to execute? Will it not affect kdb? – user3914448 Jan 20 '15 at 10:39
  • If it's the current running thread and it's single-threaded KDB instance then it'll just kill that thread, not the process. I've done this many times, works a treat :) – Manish Patel Jan 20 '15 at 11:03