|
|
1.1 moko 1: @conf[filespec]
2: $HTTPD[
3: $.mode[$env:TEST_HTTPD_MODE]
4: ]
5: $LIMITS[
6: $.max_loop(0)
7: ]
8:
9: @unhandled_exception[exception;stack]
10: $exception.type: $exception.comment^if(def $marks){$marks}^if($request:query eq 'slow-unhandled'){^sleep(8)}
11:
12:
13: @slow[p]
14: ^sleep(8)
15:
16: @CLASS
17: httpd
18:
19: @main[]
20: $response:timeout(1)
21: ^self.[$request:query][]
22:
23: @quick[]
24: quick
25:
26: @sleep[]
27: ^sleep(8)
28: not reached
29:
30: # the timeout is cancelled by 0 and restarted by the next assignment
31:
32: @cancel[]
33: $response:timeout(0)
34: ^sleep(1.5)
35: done after the timeout
36:
37: @restart[]
38: # sum of sleeps is longer than the timeout
39: ^for[i](1;9){
40: $response:timeout(2)
41: ^sleep(0.25)
42: }
43: done, the timer was restarted
44:
45: @loop[]
46: ^for[i](1;2000000000){nothing}
47: not reached
48:
49: @hang[]
50: ^file::exec[/hang.sh]
51: not reached
52:
53: @slow-unhandled[]
54: $f[^file::exec[/detach.sh]]
55: ^sleep(8)
56: not reached
57:
58: # cheking the interruption is not caught by ^try and does not run catch and finally code
59: @try[]
60: ^try{
61: ^sleep(8)
62: }{
63: $marks[ caught]
64: $exception.handled(true)
65: }
66: not reached
67:
68: @try-loop[]
69: ^try{
1.2 ! moko 70: ^for[i](1;200000000){$void}
1.1 moko 71: }{
72: $marks[ caught]
73: $exception.handled(true)
74: }
75: not reached
76:
77: @try-nested[]
78: ^try{
79: ^try{
80: ^sleep(8)
81: }{
82: $marks[ inner]
83: }{
84: $marks[$marks inner-finally]
85: }
86: }{
87: $marks[$marks outer]
88: $exception.handled(true)
89: }{
90: $marks[$marks outer-finally]
91: }
92: not reached
93:
94: # libxml calls parser://slow/ and the callback swallows the interruption, the next long operation must be interrupted again
95: @xml-callback[]
96: ^try{
97: $d[^xdoc::load[parser://slow/]]
98: }{
99: $exception.handled(true)
100: }
101: ^sleep(8)
102: not reached
103:
104: # the connection is not answered, the http client waits for its timeout (5 s)
105: @self[]
106: $f[^file::load[binary;http://localhost:8103/?quick; $.timeout(5) ]]
107: not reached