You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug#36075756 ASAN crash on MaterializeIterator<Profiler>::load_HF_row_into_hash_map() [1/2 noclose]
To see this error, we needed to run with ASAN compiled in and
--sanitize on the repro test case. It didn't trigger an ASAN error as
such, but hit an assert. Possibly this happens only with ASAN because
space usage increases on the heap due to ASAN padding before and after
allocated objects.
The error is another instance of the third issue solved in Bug#35686098
Assertion `n < size()' failed in Element_type& Mem_root_array_YY:
(quote):
"we ran out of space in the dedicated hash table upon re-reading one
of the on-disk chunks into the hash table."
The fix there was to use the general mem_root instead of the dedicated
one for the hash set operation for that particular corner case.
Specifically, we used the general mem_root when allocating the hash
map *payload*.
In this bug, we see the same issue: we can't fit the last row (#10 out
of 10 long varchar strings, i.e. blobs in the repro) into the hash
table mem_root: this time we run out when we allocate space for the
hash map *key*, in check_unique_fields_hash_map prior to calling
ImmutableStringWithLength::Encode(<hash key>). The solution is the
same, use the general mem_root for this case: i.e. we generalize the
solution from Bug#35686098 to cover running out of space for both the
key and payload.
Change-Id: Id869e6afad7c996950779c008dcf650e21b17027
Copy file name to clipboardExpand all lines: mysql-test/include/query_expression_debug.inc
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -173,4 +173,21 @@ SET SESSION tmp_table_size=default;
173
173
SET SESSION set_operations_buffer_size=default;
174
174
SET SESSION optimizer_trace="enabled=default";
175
175
176
+
--echo #
177
+
--echo # Bug#36075756 ASAN crash on MaterializeIterator<Profiler>::load_HF_row_into_hash_map()
178
+
--echo #
179
+
--echo # Simulate overflow during SS_READING_RIGHT_HF
180
+
SET SESSION set_operations_buffer_size =16384;
181
+
SET SESSION debug_set_operations_secondary_overflow_at='0 0 100 right_operand';
182
+
SET SESSION optimizer_trace="enabled=on";
183
+
SELECT*FROM t INTERSECT SELECT*FROM t ORDER BY i LIMIT1;
184
+
let $show_trace=
185
+
SELECT JSON_PRETTY(JSON_EXTRACT(trace, '$.steps[*].join_execution.steps[1]."materialize for intersect".steps[0]."de-duplicate with hash table".steps[0]'))
186
+
FROMinformation_schema.optimizer_trace;
187
+
--echo # Should show overflow injection:
188
+
eval $show_trace;
189
+
SET SESSION set_operations_buffer_size=default;
190
+
SET SESSION optimizer_trace="enabled=default";
191
+
SET SESSION debug_set_operations_secondary_overflow_at=default;
Copy file name to clipboardExpand all lines: mysql-test/r/query_expression_debug.result
+44Lines changed: 44 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -286,6 +286,28 @@ SET SESSION debug_set_operations_secondary_overflow_at= default;
286
286
SET SESSION tmp_table_size=default;
287
287
SET SESSION set_operations_buffer_size=default;
288
288
SET SESSION optimizer_trace="enabled=default";
289
+
#
290
+
# Bug#36075756 ASAN crash on MaterializeIterator<Profiler>::load_HF_row_into_hash_map()
291
+
#
292
+
# Simulate overflow during SS_READING_RIGHT_HF
293
+
SET SESSION set_operations_buffer_size = 16384;
294
+
SET SESSION debug_set_operations_secondary_overflow_at='0 0 100 right_operand';
295
+
SET SESSION optimizer_trace="enabled=on";
296
+
SELECT * FROM t INTERSECT SELECT * FROM t ORDER BY i LIMIT 1;
297
+
i d c
298
+
0 2022-04-30 abracadabra
299
+
# Should show overflow injection:
300
+
SELECT JSON_PRETTY(JSON_EXTRACT(trace, '$.steps[*].join_execution.steps[1]."materialize for intersect".steps[0]."de-duplicate with hash table".steps[0]'))
301
+
FROM information_schema.optimizer_trace;
302
+
JSON_PRETTY(JSON_EXTRACT(trace, '$.steps[*].join_execution.steps[1]."materialize for intersect".steps[0]."de-duplicate with hash table".steps[0]'))
303
+
[
304
+
{
305
+
"injected overflow: SS_READING_RIGHT_HF": {}
306
+
}
307
+
]
308
+
SET SESSION set_operations_buffer_size=default;
309
+
SET SESSION optimizer_trace="enabled=default";
310
+
SET SESSION debug_set_operations_secondary_overflow_at=default;
289
311
DROP TABLE t;
290
312
#
291
313
# Debug build companion of query_expression.inc
@@ -573,4 +595,26 @@ SET SESSION debug_set_operations_secondary_overflow_at= default;
573
595
SET SESSION tmp_table_size=default;
574
596
SET SESSION set_operations_buffer_size=default;
575
597
SET SESSION optimizer_trace="enabled=default";
598
+
#
599
+
# Bug#36075756 ASAN crash on MaterializeIterator<Profiler>::load_HF_row_into_hash_map()
600
+
#
601
+
# Simulate overflow during SS_READING_RIGHT_HF
602
+
SET SESSION set_operations_buffer_size = 16384;
603
+
SET SESSION debug_set_operations_secondary_overflow_at='0 0 100 right_operand';
604
+
SET SESSION optimizer_trace="enabled=on";
605
+
SELECT * FROM t INTERSECT SELECT * FROM t ORDER BY i LIMIT 1;
606
+
i d c
607
+
0 2022-04-30 abracadabra
608
+
# Should show overflow injection:
609
+
SELECT JSON_PRETTY(JSON_EXTRACT(trace, '$.steps[*].join_execution.steps[1]."materialize for intersect".steps[0]."de-duplicate with hash table".steps[0]'))
610
+
FROM information_schema.optimizer_trace;
611
+
JSON_PRETTY(JSON_EXTRACT(trace, '$.steps[*].join_execution.steps[1]."materialize for intersect".steps[0]."de-duplicate with hash table".steps[0]'))
612
+
[
613
+
{
614
+
"injected overflow: SS_READING_RIGHT_HF": {}
615
+
}
616
+
]
617
+
SET SESSION set_operations_buffer_size=default;
618
+
SET SESSION optimizer_trace="enabled=default";
619
+
SET SESSION debug_set_operations_secondary_overflow_at=default;
0 commit comments