Commit d2eebff
authored
We are seeing exceptions ~0.03% of the time in our integration tests:
```
org.apache.http.ConnectionClosedException: Connection closed unexpectedly
```
The `contentDecoder` does not always fully consume the body within
`SimpleInputBuffer.consumeContent`. When we return back to Apache, the
rest of the body is never delivered, and the IOSession eventually times
out and gets cleaned up. During that cleanup process, Apache calls our
Consumer with the above exception.
If we read 0 bytes and return back immediately, Apache has a better
chance to load the rest of the body/footer, and it will call
`consumeContent` again. This reduces the exception rate
down to ~0.001%.
Fix #114105
Fix #114232
Fix #114327
Fix #114385
1 parent 5021d06 commit d2eebff
File tree
8 files changed
+27
-28
lines changed- docs/changelog
- x-pack/plugin/inference/src
- main/java/org/elasticsearch/xpack/inference/external/http
- test/java/org/elasticsearch/xpack/inference/services
- anthropic
- azureaistudio
- azureopenai
- cohere
- openai
8 files changed
+27
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 12 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | 113 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
120 | 118 | | |
121 | | - | |
122 | | - | |
| 119 | + | |
123 | 120 | | |
124 | | - | |
125 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
126 | 124 | | |
127 | 125 | | |
128 | 126 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
69 | | - | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
79 | 81 | | |
80 | 82 | | |
81 | 83 | | |
82 | | - | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
532 | 532 | | |
533 | 533 | | |
534 | 534 | | |
535 | | - | |
536 | 535 | | |
537 | 536 | | |
538 | 537 | | |
| |||
578 | 577 | | |
579 | 578 | | |
580 | 579 | | |
581 | | - | |
582 | 580 | | |
583 | 581 | | |
584 | 582 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1197 | 1197 | | |
1198 | 1198 | | |
1199 | 1199 | | |
1200 | | - | |
1201 | 1200 | | |
1202 | 1201 | | |
1203 | 1202 | | |
| |||
1253 | 1252 | | |
1254 | 1253 | | |
1255 | 1254 | | |
1256 | | - | |
1257 | 1255 | | |
1258 | 1256 | | |
1259 | 1257 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1322 | 1322 | | |
1323 | 1323 | | |
1324 | 1324 | | |
1325 | | - | |
1326 | 1325 | | |
1327 | 1326 | | |
1328 | 1327 | | |
| |||
1381 | 1380 | | |
1382 | 1381 | | |
1383 | 1382 | | |
1384 | | - | |
1385 | 1383 | | |
1386 | 1384 | | |
1387 | 1385 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1532 | 1532 | | |
1533 | 1533 | | |
1534 | 1534 | | |
1535 | | - | |
1536 | 1535 | | |
1537 | 1536 | | |
1538 | 1537 | | |
| |||
1566 | 1565 | | |
1567 | 1566 | | |
1568 | 1567 | | |
1569 | | - | |
1570 | 1568 | | |
1571 | 1569 | | |
1572 | 1570 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
914 | 914 | | |
915 | 915 | | |
916 | 916 | | |
917 | | - | |
918 | 917 | | |
919 | 918 | | |
920 | 919 | | |
| |||
964 | 963 | | |
965 | 964 | | |
966 | 965 | | |
967 | | - | |
968 | 966 | | |
969 | 967 | | |
970 | 968 | | |
| |||
0 commit comments