# Timeouts

**URL:** <https://forum.kx.com/t/timeouts/9034>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [August 20, 2014, 2:52am UTC](https://forum.kx.com/t/timeouts/9034 "2014-08-20T02:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh\_helzer](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@josh\_helzer](https://forum.kx.com/u/josh_helzer)\
**Post date:** [August 20, 2014, 2:52am UTC](https://forum.kx.com/t/timeouts/9034/1 "2014-08-20T02:52:00Z")

</div>

Hello,

I’m seeing what I think is incorrect behavior with timeouts:

First, start server process with 1-second timeout, and create a test table for querying:

j@m5:~$ q -T 1 -p 5000  
KDB+ 3.1 2014.07.01 Copyright (C) 1993-2014 Kx Systems  
l32/ 4()core 15748MB j m5 127.0.1.1 NONEXPIRE&nbsp;

q)t:(x:til 100000000)

Then, create a client process and run some queries against the server above:

KDB+ 3.1 2014.07.01 Copyright (C) 1993-2014 Kx Systems  
l32/ 4()core 15748MB j m5 127.0.1.1 NONEXPIRE&nbsp;

q)h:hopen`::5000 q)\t h"select log x from t;"&nbsp; / query is interrupted as expected 'stop q)\t @[h;"select log x from t;";`]&nbsp; / but it still exceeds timeout threshold  
3458

Also, update queries don’t seem to time out at all, regardless of timeout.&nbsp; Continuing the client session above:

q)\t h"update x:log x from t;"  
3509

Nor do other, non-select statements time out, e.g.:

q)\t h"log t`x;"  
3399

I’m not sure whether the last is erroneous or not - the command line reference mentions that the timeout applies to “client queries”, but the \T reference says “client call”.

---

<div class="post-metadata">

**Author:** ![rory\_ororke](https://avatars.discourse-cdn.com/v4/letter/r/49beb7/32.png) [@rory\_ororke](https://forum.kx.com/u/rory_ororke)\
**Post date:** [August 20, 2014, 7:20am UTC](https://forum.kx.com/t/timeouts/9034/2 "2014-08-20T07:20:00Z")

</div>

Hi John,  
The timeout setting can be circumvented in some occasions.

From Charlie

_“The timeout (and also interruption via ctrl-c) areimplemented via the setting of a flag which is polled at certain points ofexecution (e.g. function exit), where early return is manageable and theoverhead of polling does not impact performance significantly.”_

So therefore certain scenarios can cause the execution to complete before the flag is checked.

Thanks Rory
