Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use-after-free in cql3::query_processor::migration_subscriber::on_drop_column_family #15097

Closed
bhalevy opened this issue Aug 20, 2023 · 7 comments
Assignees
Milestone

Comments

@bhalevy
Copy link
Member

bhalevy commented Aug 20, 2023

Seen in https://jenkins.scylladb.com/view/master/job/scylla-master/job/dtest-debug/249/artifact/logs-full.debug.020/1692515592211_schema_management_test.py%3A%3ATestSchemaManagement%3A%3Atest_update_schema_while_node_is_killed%5Bdrop_table%5D/node2.log

Scylla version 5.4.0~dev-0.20230815.d57a951d484b with build-id 7ac5cc59cca9d066824d1cd44486c2b382494665 starting ...

INFO  2023-08-20 07:13:07,976 [shard 0] schema_tables - Dropping ks.cf id=d8739800-3f28-11ee-a7e1-dbd52ee4849c version=464d85bb-4593-3d2c-ab9f-3ce2f127e0ed
INFO  2023-08-20 07:13:07,976 [shard 0] database - Dropping ks.cf with auto-snapshot
INFO  2023-08-20 07:13:07,978 [shard 0] database - Truncating ks.cf with auto-snapshot
INFO  2023-08-20 07:13:08,205 [shard 0] compaction_manager - Asked to stop
INFO  2023-08-20 07:13:08,206 [shard 0] compaction_manager - Stopping 1 tasks for 1 ongoing compactions due to shutdown
WARN  2023-08-20 07:13:08,206 [shard 0] cdc - Aborted update CDC description table with generation (2023/08/20 07:10:28, 7b25653e-9fb8-46df-a6d7-5a21a4ccaabe)
INFO  2023-08-20 07:13:08,264 [shard 0] init - Signal received; shutting down
INFO  2023-08-20 07:13:08,264 [shard 0] init - Shutting down view builder ops
INFO  2023-08-20 07:13:08,264 [shard 0] view - Draining view builder
INFO  2023-08-20 07:13:08,270 [shard 1] view - Draining view builder
INFO  2023-08-20 07:13:08,272 [shard 1] compaction_manager - Asked to stop
WARN  2023-08-20 07:13:08,273 [shard 0] gossip - failure_detector_loop: Got error in the loop, live_nodes={127.0.19.3, 127.0.19.1}: seastar::sleep_aborted (Sleep is aborted)
INFO  2023-08-20 07:13:08,273 [shard 0] gossip - failure_detector_loop: Finished main loop
INFO  2023-08-20 07:13:08,334 [shard 1] compaction_manager - Stopped
=================================================================
==24598==ERROR: AddressSanitizer: heap-use-after-free on address 0x6190000230b7 at pc 0x00000d2247bd bp 0x7f4232341b30 sp 0x7f4232341b28
READ of size 1 at 0x6190000230b7 thread T1
INFO  2023-08-20 07:13:08,388 [shard 0] compaction - [Compact system.local 036454a0-3f29-11ee-964a-a4e02b57ff0c] Compacted 5 sstables to [/jenkins/workspace/scylla-master/dtest-debug/scylla/.dtest/dtest-couu1ee_/test/node2/data/system/local-7ad54392bcdd35a684174e047860b377/me-3g8o_0k1v_5h6rk2aa12d7hhvx8s-big-Data.db:level=0]. 45kB to 13kB (~29% of original) in 463ms = 97kB/s. ~640 total partitions merged to 1.
*** stack smashing detected ***: terminated
==24598==WARNING: Can't read from symbolizer at fd 37
==24598==WARNING: Can't write to symbolizer at fd 41
*** stack smashing detected ***: terminated
==24598==WARNING: Can't read from symbolizer at fd 32
==24598==WARNING: Can't write to symbolizer at fd 35
INFO  2023-08-20 07:13:08,534 [shard 0] gossip - Got shutdown message from 127.0.19.3, received_generation=1692515408, local_generation=1692515408
*** stack smashing detected ***: terminated
==24598==WARNING: Can't read from symbolizer at fd 32
==24598==WARNING: Can't write to symbolizer at fd 35
INFO  2023-08-20 07:13:08,587 [shard 0] gossip - Got shutdown message from 127.0.19.1, received_generation=1692515328, local_generation=1692515328
*** stack smashing detected ***: terminated
==24598==WARNING: Can't read from symbolizer at fd 32
==24598==WARNING: Can't write to symbolizer at fd 35
==24598==WARNING: Failed to use and restart external symbolizer!
    #0 0xd2247bc  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd2247bc) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #1 0x10e0d1bb  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0x10e0d1bb) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #2 0x108d798c  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0x108d798c) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #3 0x1091beaf  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0x1091beaf) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #4 0x108d72cc  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0x108d72cc) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #5 0x7f42c6a1be5d  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x421be5d) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #6 0x7f42c726a8a7  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4a6a8a7) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)

0x6190000230b7 is located 55 bytes inside of 912-byte region [0x619000023080,0x619000023410)
freed by thread T1 here:
    #0 0xd12b661  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd12b661) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #1 0x113b6544  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0x113b6544) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #2 0xd2ccf67  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd2ccf67) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #3 0xd2cca2d  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd2cca2d) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #4 0x7f42c6d5e248  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x455e248) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #5 0x7f42c6d6635e  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x456635e) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #6 0x7f42c6d6a240  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x456a240) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #7 0x7f42c6e650aa  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46650aa) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #8 0x7f42c6e638d0  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46638d0) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #9 0x7f42c6e637c0  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46637c0) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #10 0x7f42c6e62f2c  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4662f2c) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #11 0x7f42c6b36fc8  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4336fc8) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #12 0x7f42c0aae906  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x8c906) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)

previously allocated by thread T1 here:
    #0 0xd12ade1  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd12ade1) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #1 0xeb4d887  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xeb4d887) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #2 0xeae24d3  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xeae24d3) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #3 0x1132b59b  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0x1132b59b) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #4 0xeb776fa  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xeb776fa) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #5 0xeb56316  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xeb56316) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #6 0xeb5ad12  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xeb5ad12) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #7 0xeb61e9a  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xeb61e9a) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #8 0xeb5ea6a  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xeb5ea6a) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #9 0x113b642b  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0x113b642b) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #10 0xd2ccf67  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd2ccf67) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #11 0xd2cca2d  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd2cca2d) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #12 0x7f42c6d5e248  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x455e248) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #13 0x7f42c6d6635e  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x456635e) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #14 0x7f42c6d6a240  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x456a240) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #15 0x7f42c6e650aa  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46650aa) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #16 0x7f42c6e638d0  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46638d0) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #17 0x7f42c6e637c0  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46637c0) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #18 0x7f42c6e62f2c  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4662f2c) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #19 0x7f42c6b36fc8  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4336fc8) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #20 0x7f42c0aae906  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x8c906) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)

Thread T1 created by T0 here:
    #0 0xd0d72ee  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd0d72ee) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #1 0x7f42c6b37823  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4337823) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #2 0x7f42c6b371b5  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x43371b5) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #3 0x7f42c6f89cba  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4789cba) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #4 0x7f42c6f88d7e  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4788d7e) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #5 0x7f42c6eca92d  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46ca92d) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #6 0x7f42c6d89924  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4589924) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #7 0x7f42c6d9019f  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x459019f) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #8 0x7f42c68de24d  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x40de24d) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #9 0x7f42c68dbb5a  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x40dbb5a) (BuildId: 783cc8d07727c4ae44ca270b618cb1ddad74277c)
    #10 0xd13397b  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd13397b) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #11 0xd13041f  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd13041f) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)
    #12 0x7f42c0a49b49  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x27b49) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #13 0x7f42c0a49c0a  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x27c0a) (BuildId: 245240a31888ad5c11bbc55b18e02d87388f59a9)
    #14 0xd0547a4  (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd0547a4) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665)

SUMMARY: AddressSanitizer: heap-use-after-free (/jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libexec/scylla+0xd2247bc) (BuildId: 7ac5cc59cca9d066824d1cd44486c2b382494665) 
Shadow bytes around the buggy address:
  0x619000022e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x619000022e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x619000022f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x619000022f80: 00 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x619000023000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x619000023080: fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd
  0x619000023100: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x619000023180: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x619000023200: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x619000023280: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x619000023300: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==24598==ABORTING
Aborting on shard 1.
Backtrace:
  0xd099eca
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46f401c
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x46f3c73
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x453cae8
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x456bd35
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4662a29
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4662d6e
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4662b7e
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x3db6f
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x8e843
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x3dabd
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libc.so.6+0x2687e
  0xd113cea
  0xd111a94
  0xd0f7dc9
  0xd0f6c5c
  0xd0f7f4b
  0xd2247bc
  0x10e0d1bb
  0x108d798c
  0x1091beaf
  0x108d72cc
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x421be5d
  /jenkins/workspace/scylla-master/dtest-debug/scylla/.ccm/scylla-repository/d57a951d484bec775ffe82e82815205f533dadb8/libreloc/libseastar.so+0x4a6a8a7
*** stack smashing detected ***: terminated
@bhalevy
Copy link
Member Author

bhalevy commented Aug 20, 2023

Decoded:

[Backtrace #0]
seastar::basic_sstring<char, unsigned int, 15u, true>::is_internal() const at ././seastar/include/seastar/core/sstring.hh:95
 (inlined by) basic_sstring at ././seastar/include/seastar/core/sstring.hh:132
cql3::query_processor::migration_subscriber::on_drop_column_family(seastar::basic_sstring<char, unsigned int, 15u, true> const&, seastar::basic_sstring<char, unsigned int, 15u, true> const&) at ./cql3/query_processor.cc:998
std::function<void (service::migration_listener*)>::operator()(service::migration_listener*) const at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/std_function.h:591
 (inlined by) operator() at ./service/migration_manager.cc:432
 (inlined by) seastar::noncopyable_function<void (service::migration_listener*)>::direct_vtable_for<service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0::operator()() const::{lambda(service::migration_listener*)#1}>::call(seastar::noncopyable_function<void (service::migration_listener*)> const*, service::migration_listener*) at ././seastar/include/seastar/util/noncopyable_function.hh:129
seastar::noncopyable_function<void (service::migration_listener*)>::operator()(service::migration_listener*) const at ././seastar/include/seastar/util/noncopyable_function.hh:215
 (inlined by) atomic_vector<service::migration_listener*>::thread_for_each(seastar::noncopyable_function<void (service::migration_listener*)>) at ././utils/atomic_vector.hh:50
operator() at ./service/migration_manager.cc:430
 (inlined by) void std::__invoke_impl<void, service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0>(std::__invoke_other, service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:61
 (inlined by) std::__invoke_result<service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0>::type std::__invoke<service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0>(service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:96
 (inlined by) decltype(auto) std::__apply_impl<service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0, std::tuple<>>(service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0&&, std::tuple<>&&, std::integer_sequence<unsigned long>) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/tuple:2288
 (inlined by) decltype(auto) std::apply<service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0, std::tuple<> >(service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0&&, std::tuple<>&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/tuple:2299
 (inlined by) seastar::future<void> seastar::futurize<void>::apply<service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0>(service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0&&, std::tuple<>&&) at ././seastar/include/seastar/core/future.hh:1970
 (inlined by) operator() at ././seastar/include/seastar/core/thread.hh:262
 (inlined by) seastar::noncopyable_function<void ()>::direct_vtable_for<seastar::async<service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0>(seastar::thread_attributes, service::migration_notifier::on_schema_change(std::function<void (service::migration_listener*)>, std::function<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > (std::__exception_ptr::exception_ptr)>)::$_0&&)::{lambda()#1}>::call(seastar::noncopyable_function<void ()> const*) at ././seastar/include/seastar/util/noncopyable_function.hh:129
seastar::noncopyable_function<void ()>::operator()() const at ./build/debug/seastar/./seastar/include/seastar/util/noncopyable_function.hh:215
seastar::thread_context::main() at ./build/debug/seastar/./seastar/src/core/thread.cc:311
freed by thread T1 here:[Backtrace #1]
operator delete(void*) at ??:?
seastar::internal::lw_shared_ptr_accessors_esft<schema>::dispose(schema*) at ././seastar/include/seastar/core/shared_ptr.hh:212
 (inlined by) seastar::internal::lw_shared_ptr_accessors_esft<schema>::dispose(seastar::lw_shared_ptr_counter_base*) at ././seastar/include/seastar/core/shared_ptr.hh:209
 (inlined by) ~lw_shared_ptr at ././seastar/include/seastar/core/shared_ptr.hh:325
 (inlined by) operator()<db::schema_tables::schema_diff::dropped_schema &> at ./db/schema_tables.cc:1556
 (inlined by) seastar::future<void> seastar::futurize<seastar::future<void> >::invoke<db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&>(db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&) at ././seastar/include/seastar/core/future.hh:2006
 (inlined by) auto seastar::futurize_invoke<db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&>(db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&) at ././seastar/include/seastar/core/future.hh:2037
 (inlined by) operator() at ././seastar/include/seastar/core/loop.hh:701
 (inlined by) seastar::future seastar::futurize<void>::invoke<seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&>(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&) at ././seastar/include/seastar/core/future.hh:2003
 (inlined by) auto seastar::futurize_invoke<seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&>(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&) at ././seastar/include/seastar/core/future.hh:2037
 (inlined by) operator()<> at ././seastar/include/seastar/core/future.hh:1406
 (inlined by) _ZN7seastar20noncopyable_functionIFNS_6futureIvEEvEE17direct_vtable_forIZNS2_4thenIZZZNS_23max_concurrent_for_eachIN9__gnu_cxx17__normal_iteratorIPN2db13schema_tables11schema_diff14dropped_schemaESt6vectorISD_SaISD_EEEESI_ZZNSB_L22merge_tables_and_viewsERNS_7shardedIN7service13storage_proxyEEERNSJ_INSA_15system_keyspaceEEEOSt3mapIN5utils11tagged_uuidI12table_id_tagEE16schema_mutationsSt4lessISV_ESaISt4pairIKSV_SW_EEES14_S14_S14_bbENK3$_3clERN7replica8databaseEEUlOT_E0_EES2_S19_T0_mOT1_ENKUlRZNS7_ISI_SI_S1B_EES2_S19_S1C_mS1E_E5stateE_clES1G_ENKUlvE0_clEvEUlvE_S2_EES1C_S1A_EUlDpOT_E_E4callEPKS4_ at ././seastar/include/seastar/util/noncopyable_function.hh:129
seastar::noncopyable_function<seastar::future<void> ()>::operator()() const at ././seastar/include/seastar/util/noncopyable_function.hh:215
 (inlined by) seastar::future<void> std::__invoke_impl<seastar::future<void>, seastar::noncopyable_function<seastar::future<void> ()>&>(std::__invoke_other, seastar::noncopyable_function<seastar::future<void> ()>&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:61
 (inlined by) std::__invoke_result<seastar::noncopyable_function<seastar::future<void> ()>&>::type std::__invoke<seastar::noncopyable_function<seastar::future<void> ()>&>(seastar::noncopyable_function<seastar::future<void> ()>&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:96
 (inlined by) std::invoke_result<seastar::noncopyable_function<seastar::future<void> ()>&>::type std::invoke<seastar::noncopyable_function<seastar::future<void> ()>&>(seastar::noncopyable_function<seastar::future<void> ()>&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/functional:113
 (inlined by) auto seastar::internal::future_invoke<seastar::noncopyable_function<seastar::future<void> ()>&, seastar::internal::monostate>(seastar::noncopyable_function<seastar::future<void> ()>&, seastar::internal::monostate&&) at ././seastar/include/seastar/core/future.hh:1155
 (inlined by) operator() at ././seastar/include/seastar/core/future.hh:1458
operator() at ././seastar/include/seastar/core/future.hh:1454
 (inlined by) seastar::continuation<seastar::internal::promise_base_with_type<void>, seastar::noncopyable_function<seastar::future<void> ()>, seastar::future<void>::then_impl_nrvo<seastar::noncopyable_function<seastar::future<void> ()>, seastar::future<void> >(seastar::noncopyable_function<seastar::future<void> ()>&&)::{lambda(seastar::internal::promise_base_with_type<void>&&, seastar::noncopyable_function<seastar::future<void> ()>&, seastar::future_state<seastar::internal::monostate>&&)#1}, void>::run_and_dispose() at ././seastar/include/seastar/core/future.hh:741
seastar::reactor::run_tasks(seastar::reactor::task_queue&) at ./build/debug/seastar/./seastar/src/core/reactor.cc:2597
seastar::reactor::run_some_tasks() at ./build/debug/seastar/./seastar/src/core/reactor.cc:3060
seastar::reactor::do_run() at ./build/debug/seastar/./seastar/src/core/reactor.cc:3229
operator() at ./build/debug/seastar/./seastar/src/core/reactor.cc:4440
void std::__invoke_impl<void, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&>(std::__invoke_other, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:61
std::enable_if<is_invocable_r_v<void, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&>, void>::type std::__invoke_r<void, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&>(seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:111
std::_Function_handler<void (), seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0>::_M_invoke(std::_Any_data const&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/std_function.h:290
seastar::posix_thread::start_routine(void*) at ./build/debug/seastar/./seastar/src/core/posix.cc:90
/data/scylla-s3-reloc.cache/by-build-id/7ac5cc59cca9d066824d1cd44486c2b382494665/extracted/scylla/libreloc/libc.so.6: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=245240a31888ad5c11bbc55b18e02d87388f59a9, for GNU/Linux 3.2.0, not stripped

start_thread at ??:?
previously allocated by thread T1 here:[Backtrace #2]
operator new(unsigned long) at ??:?
seastar::lw_shared_ptr<schema> seastar::lw_shared_ptr<schema>::make<schema::private_tag, schema::raw_schema&, std::optional<raw_view_info>&, schema_static_props&>(schema::private_tag&&, schema::raw_schema&, std::optional<raw_view_info>&, schema_static_props&) at ././seastar/include/seastar/core/shared_ptr.hh:282
seastar::lw_shared_ptr<schema> seastar::make_lw_shared<schema, schema::private_tag, schema::raw_schema&, std::optional<raw_view_info>&, schema_static_props&>(schema::private_tag&&, schema::raw_schema&, std::optional<raw_view_info>&, schema_static_props&) at ././seastar/include/seastar/core/shared_ptr.hh:443
 (inlined by) schema_builder::build() at ./schema/schema.cc:1367
db::schema_tables::create_table_from_mutations(db::schema_ctxt const&, schema_mutations, std::optional<utils::tagged_uuid<table_schema_version_tag> >) at ./db/schema_tables.cc:3146
frozen_schema::unfreeze(db::schema_ctxt const&) const at ./frozen_schema.cc:33
schema_registry_entry::get_schema() at ./schema/schema_registry.cc:225
schema_registry::get_or_null(utils::tagged_uuid<table_schema_version_tag>) const at ./schema/schema_registry.cc:146
operator() at ./schema/schema_registry.cc:323
global_schema_ptr::get() const at ./schema/schema_registry.cc:344
global_schema_ptr::operator seastar::lw_shared_ptr<schema const>() const at ././schema/schema_registry.hh:174
 (inlined by) operator()<db::schema_tables::schema_diff::dropped_schema &> at ./db/schema_tables.cc:1556
 (inlined by) seastar::future<void> seastar::futurize<seastar::future<void> >::invoke<db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&>(db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&) at ././seastar/include/seastar/core/future.hh:2006
 (inlined by) auto seastar::futurize_invoke<db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&>(db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&, db::schema_tables::schema_diff::dropped_schema&) at ././seastar/include/seastar/core/future.hh:2037
 (inlined by) operator() at ././seastar/include/seastar/core/loop.hh:701
 (inlined by) seastar::future seastar::futurize<void>::invoke<seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&>(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&) at ././seastar/include/seastar/core/future.hh:2003
 (inlined by) auto seastar::futurize_invoke<seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&>(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, unsigned long, db::schema_tables::merge_tables_and_views(seastar::sharded<service::storage_proxy>&, seastar::sharded<db::system_keyspace>&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, std::map<utils::tagged_uuid<table_id_tag>, schema_mutations, std::less<utils::tagged_uuid<table_id_tag> >, std::allocator<std::pair<utils::tagged_uuid<table_id_tag> const, schema_mutations> > >&&, bool, bool)::$_3::operator()(replica::database&) const::{lambda(auto:1&&)#2}&&)::{lambda(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(auto:1, seastar::future<void>, unsigned long, auto:3)::state&)#1}::operator()(seastar::max_concurrent_for_each<__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, __gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, {lambda(auto:1&&)#2}>(__gnu_cxx::__normal_iterator<db::schema_tables::schema_diff::dropped_schema*, std::vector<db::schema_tables::schema_diff::dropped_schema, std::allocator<db::schema_tables::schema_diff::dropped_schema> > >, seastar::future<void>, unsigned long, {lambda(auto:1&&)#2})::state) const::{lambda()#2}::operator()() const::{lambda()#1}&) at ././seastar/include/seastar/core/future.hh:2037
 (inlined by) operator()<> at ././seastar/include/seastar/core/future.hh:1406
 (inlined by) _ZN7seastar20noncopyable_functionIFNS_6futureIvEEvEE17direct_vtable_forIZNS2_4thenIZZZNS_23max_concurrent_for_eachIN9__gnu_cxx17__normal_iteratorIPN2db13schema_tables11schema_diff14dropped_schemaESt6vectorISD_SaISD_EEEESI_ZZNSB_L22merge_tables_and_viewsERNS_7shardedIN7service13storage_proxyEEERNSJ_INSA_15system_keyspaceEEEOSt3mapIN5utils11tagged_uuidI12table_id_tagEE16schema_mutationsSt4lessISV_ESaISt4pairIKSV_SW_EEES14_S14_S14_bbENK3$_3clERN7replica8databaseEEUlOT_E0_EES2_S19_T0_mOT1_ENKUlRZNS7_ISI_SI_S1B_EES2_S19_S1C_mS1E_E5stateE_clES1G_ENKUlvE0_clEvEUlvE_S2_EES1C_S1A_EUlDpOT_E_E4callEPKS4_ at ././seastar/include/seastar/util/noncopyable_function.hh:129
seastar::noncopyable_function<seastar::future<void> ()>::operator()() const at ././seastar/include/seastar/util/noncopyable_function.hh:215
 (inlined by) seastar::future<void> std::__invoke_impl<seastar::future<void>, seastar::noncopyable_function<seastar::future<void> ()>&>(std::__invoke_other, seastar::noncopyable_function<seastar::future<void> ()>&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:61
 (inlined by) std::__invoke_result<seastar::noncopyable_function<seastar::future<void> ()>&>::type std::__invoke<seastar::noncopyable_function<seastar::future<void> ()>&>(seastar::noncopyable_function<seastar::future<void> ()>&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:96
 (inlined by) std::invoke_result<seastar::noncopyable_function<seastar::future<void> ()>&>::type std::invoke<seastar::noncopyable_function<seastar::future<void> ()>&>(seastar::noncopyable_function<seastar::future<void> ()>&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/functional:113
 (inlined by) auto seastar::internal::future_invoke<seastar::noncopyable_function<seastar::future<void> ()>&, seastar::internal::monostate>(seastar::noncopyable_function<seastar::future<void> ()>&, seastar::internal::monostate&&) at ././seastar/include/seastar/core/future.hh:1155
 (inlined by) operator() at ././seastar/include/seastar/core/future.hh:1458
operator() at ././seastar/include/seastar/core/future.hh:1454
 (inlined by) seastar::continuation<seastar::internal::promise_base_with_type<void>, seastar::noncopyable_function<seastar::future<void> ()>, seastar::future<void>::then_impl_nrvo<seastar::noncopyable_function<seastar::future<void> ()>, seastar::future<void> >(seastar::noncopyable_function<seastar::future<void> ()>&&)::{lambda(seastar::internal::promise_base_with_type<void>&&, seastar::noncopyable_function<seastar::future<void> ()>&, seastar::future_state<seastar::internal::monostate>&&)#1}, void>::run_and_dispose() at ././seastar/include/seastar/core/future.hh:741
seastar::reactor::run_tasks(seastar::reactor::task_queue&) at ./build/debug/seastar/./seastar/src/core/reactor.cc:2597
seastar::reactor::run_some_tasks() at ./build/debug/seastar/./seastar/src/core/reactor.cc:3060
seastar::reactor::do_run() at ./build/debug/seastar/./seastar/src/core/reactor.cc:3229
operator() at ./build/debug/seastar/./seastar/src/core/reactor.cc:4440
void std::__invoke_impl<void, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&>(std::__invoke_other, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:61
std::enable_if<is_invocable_r_v<void, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&>, void>::type std::__invoke_r<void, seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&>(seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/invoke.h:111
std::_Function_handler<void (), seastar::smp::configure(seastar::smp_options const&, seastar::reactor_options const&)::$_0>::_M_invoke(std::_Any_data const&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/std_function.h:290
seastar::posix_thread::start_routine(void*) at ./build/debug/seastar/./seastar/src/core/posix.cc:90
start_thread at ??:?

@bhalevy
Copy link
Member Author

bhalevy commented Aug 20, 2023

Looks like this was exposed with 825d617, maybe in combination of clang 16 (miscompile?).

My theory is that the schema_ptr passed to:

future<> migration_notifier::drop_column_family(const schema_ptr& cfm) {

is a temporary implicitly created by schema_registry_entry::get_schema() which life is not extended as it should and it gets freed when migration_notifier::drop_column_family yields.

@bhalevy bhalevy assigned cvybhu and bhalevy and unassigned cvybhu Aug 20, 2023
@bhalevy
Copy link
Member Author

bhalevy commented Aug 20, 2023

Cc @avikivity

@bhalevy
Copy link
Member Author

bhalevy commented Aug 20, 2023

Reproduced with this patch:

diff --git a/service/migration_manager.cc b/service/migration_manager.cc
index 78acb8aeb3..90fee4e9df 100644
--- a/service/migration_manager.cc
+++ b/service/migration_manager.cc
@@ -566,6 +566,7 @@ future<> migration_notifier::drop_keyspace(const sstring& ks_name) {
 future<> migration_notifier::drop_column_family(const schema_ptr& cfm) {
     const auto& ks_name = cfm->ks_name();
     const auto& cf_name = cfm->cf_name();
+    co_await sleep(1ms);
     co_await on_schema_change([&] (migration_listener* listener) {
         listener->on_drop_column_family(ks_name, cf_name);
     }, [&] (std::exception_ptr ex) {

bhalevy added a commit to bhalevy/scylla that referenced this issue Aug 20, 2023
To prevent use-after-free as seen in
scylladb#15097
where a temp schema_ptr retrieved from a global_schema_ptr
get destroyed when the notification function yielded.

Capturing the schema_ptr on the coroutine frame
is inexpensive since its a shared ptr and it makes sure
that the schema remains valid throughput the coroutine
life time.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
bhalevy added a commit to bhalevy/scylla that referenced this issue Aug 20, 2023
To prevent use-after-free as seen in
scylladb#15097
where a temp schema_ptr retrieved from a global_schema_ptr
get destroyed when the notification function yielded.

Capturing the schema_ptr on the coroutine frame
is inexpensive since its a shared ptr and it makes sure
that the schema remains valid throughput the coroutine
life time.

Fixes scylladb#15097

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
@bhalevy
Copy link
Member Author

bhalevy commented Aug 20, 2023

Hmm, it looks like the culprit is at the call site:

        co_await notify(tables_diff.dropped, [&] (auto&& dt) { return db.get_notifier().drop_column_family(dt.schema); });

The life of the temporary schema_ptr generated from dt.schema is not extended since the lambda is a regular future<> return function so when it returns the unavailable future no state is saved.

OTOH turning the lambda into a coroutine lambda and doing co_await db.get_notifier().drop_column_family(dt.schema); would hold on to the temporary arg until drop_column_family's future resolves.

I reproduced this with a reduced unit test in seastar:

SEASTAR_TEST_CASE(test_coro_arg_life_extension) {
    struct value {
        int i;
        value(int v) : i(v) {
            seastar_logger.info("value {}", i);
        }
        ~value() {
            seastar_logger.info("~value {}", i);
            i = -1;
        }
    };
    struct gen {
        int i = 0;
        gen() = default;
        gen(int first) : i(first) {}
        value operator()() {
            return value(++i);
        }
        operator value() {
            return this->operator()();
        }
    };
    auto coro = [] (const value& v) -> future<> {
        auto saved = v.i;
        seastar_logger.info("entered coro {}", v.i);
        co_await sleep(1ms);
        seastar_logger.info("resumed coro {}", v.i);
        BOOST_REQUIRE_EQUAL(saved, v.i);
    };
    std::vector<gen> gens;
    gens.reserve(3);
    gens.emplace_back(0);
    gens.emplace_back(10);
    gens.emplace_back(20);
    co_await parallel_for_each(gens, [&] (gen& g) { return coro(g); });
}

@avikivity
Copy link
Member

And when did this start?

@bhalevy
Copy link
Member Author

bhalevy commented Aug 20, 2023

And when did this start?

825d617

raphaelsc pushed a commit to raphaelsc/scylla that referenced this issue Aug 22, 2023
To prevent use-after-free as seen in
scylladb#15097
where a temp schema_ptr retrieved from a global_schema_ptr
get destroyed when the notification function yielded.

Capturing the schema_ptr on the coroutine frame
is inexpensive since its a shared ptr and it makes sure
that the schema remains valid throughput the coroutine
life time.

Fixes scylladb#15097

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes scylladb#15098
raphaelsc pushed a commit to raphaelsc/scylla that referenced this issue Aug 29, 2023
To prevent use-after-free as seen in
scylladb#15097
where a temp schema_ptr retrieved from a global_schema_ptr
get destroyed when the notification function yielded.

Capturing the schema_ptr on the coroutine frame
is inexpensive since its a shared ptr and it makes sure
that the schema remains valid throughput the coroutine
life time.

Fixes scylladb#15097

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

Closes scylladb#15098
@DoronArazii DoronArazii added this to the 5.4 milestone Aug 29, 2023
bhalevy added a commit to bhalevy/scylla that referenced this issue Oct 29, 2023
To prevent use-after-free as seen in
scylladb#15097
where a temp schema_ptr retrieved from a global_schema_ptr
get destroyed when the notification function yielded.

Capturing the schema_ptr on the coroutine frame
is inexpensive since its a shared ptr and it makes sure
that the schema remains valid throughput the coroutine
life time.

\Fixes scylladb#15097

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>

\Closes scylladb#15098

(cherry picked from commit 0f54e24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants