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

INSERT JSON without a JSON value crashes Scylla #14709

Closed
cvybhu opened this issue Jul 14, 2023 · 4 comments
Closed

INSERT JSON without a JSON value crashes Scylla #14709

cvybhu opened this issue Jul 14, 2023 · 4 comments

Comments

@cvybhu
Copy link
Contributor

cvybhu commented Jul 14, 2023

It's possible to do INSERT INTO tab JSON wihtout providing a valid JSON value:
This crashes scylla.

cqlsh:ks> CREATE TABLE ks.tab (p int PRIMARY KEY);
cqlsh:ks> INSERT INTO tab JSON;
NoHostAvailable: ('Unable to complete the operation against any hosts', {<Host: 127.0.0.1:9042 datacenter1>: ConnectionShutdown('Connection to 127.0.0.1:9042 was closed')})

Backtrace:

[Backtrace #0]
void seastar::backtrace<seastar::backtrace_buffer::append_backtrace()::{lambda(seastar::frame)#1}>(seastar::backtrace_buffer::append_backtrace()::{lambda(seastar::frame)#1}&&) at ./build/dev/seastar/./seastar/include/seastar/util/backtrace.hh:64
 (inlined by) seastar::backtrace_buffer::append_backtrace() at ./build/dev/seastar/./seastar/src/core/reactor.cc:811
 (inlined by) seastar::print_with_backtrace(seastar::backtrace_buffer&, bool) at ./build/dev/seastar/./seastar/src/core/reactor.cc:841
seastar::print_with_backtrace(char const*, bool) at ./build/dev/seastar/./seastar/src/core/reactor.cc:853
 (inlined by) seastar::sigabrt_action() at ./build/dev/seastar/./seastar/src/core/reactor.cc:3969
 (inlined by) operator() at ./build/dev/seastar/./seastar/src/core/reactor.cc:3945
 (inlined by) __invoke at ./build/dev/seastar/./seastar/src/core/reactor.cc:3941
/lib64/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]=81daba31ee66dbd63efdc4252a872949d874d136, for GNU/Linux 3.2.0, not stripped

__GI___sigaction at :?
__pthread_kill_implementation at ??:?
__GI_raise at :?
__GI_abort at :?
__assert_fail_base.cold at ??:?
__GI___assert_fail at :?
cql3::statements::raw::insert_json_statement::prepare_internal(data_dictionary::database, seastar::lw_shared_ptr<schema const>, cql3::prepare_context&, std::unique_ptr<cql3::attributes, std::default_delete<cql3::attributes> >, cql3::cql_stats&) const at /tmp/cql3/statements/update_statement.cc:437
cql3::statements::raw::modification_statement::prepare(data_dictionary::database, cql3::prepare_context&, cql3::cql_stats&) const at /tmp/cql3/statements/modification_statement.cc:488
cql3::statements::raw::modification_statement::prepare_statement(data_dictionary::database, cql3::prepare_context&, cql3::cql_stats&) at /tmp/cql3/statements/modification_statement.cc:463
cql3::statements::raw::modification_statement::prepare(data_dictionary::database, cql3::cql_stats&) at /tmp/cql3/statements/modification_statement.cc:476
cql3::query_processor::get_statement(std::basic_string_view<char, std::char_traits<char> > const&, service::client_state const&) at /tmp/cql3/query_processor.cc:613
cql3::query_processor::execute_direct_without_checking_exception_message(std::basic_string_view<char, std::char_traits<char> > const&, service::query_state&, cql3::query_options&) at /tmp/cql3/query_processor.cc:495
cql_transport::process_query_internal(service::client_state&, seastar::sharded<cql3::query_processor>&, cql_transport::request_reader, unsigned short, unsigned char, service_permit, tracing::trace_state_ptr, bool, std::unordered_map<unsigned char, std::optional<seastar::basic_sstring<signed char, unsigned int, 31u, false> >, std::hash<unsigned char>, std::equal_to<unsigned char>, std::allocator<std::pair<unsigned char const, std::optional<seastar::basic_sstring<signed char, unsigned int, 31u, false> > > > >) at /tmp/transport/server.cc:1029
seastar::future<boost::outcome_v2::basic_result<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > >, utils::exception_container<exceptions::mutation_write_timeout_exception, exceptions::read_timeout_exception, exceptions::read_failure_exception, exceptions::rate_limit_exception>, utils::exception_container_throw_policy> > cql_transport::cql_server::connection::process<seastar::future<std::variant<boost::outcome_v2::basic_result<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > >, utils::exception_container<exceptions::mutation_write_timeout_exception, exceptions::read_timeout_exception, exceptions::read_failure_exception, exceptions::rate_limit_exception>, utils::exception_container_throw_policy>, seastar::shared_ptr<cql_transport::messages::result_message::bounce_to_shard> > > (*)(service::client_state&, seastar::sharded<cql3::query_processor>&, cql_transport::request_reader, unsigned short, unsigned char, service_permit, tracing::trace_state_ptr, bool, std::unordered_map<unsigned char, std::optional<seastar::basic_sstring<signed char, unsigned int, 31u, false> >, std::hash<unsigned char>, std::equal_to<unsigned char>, std::allocator<std::pair<unsigned char const, std::optional<seastar::basic_sstring<signed char, unsigned int, 31u, false> > > > >)>(unsigned short, cql_transport::request_reader, service::client_state&, service_permit, tracing::trace_state_ptr, seastar::future<std::variant<boost::outcome_v2::basic_result<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > >, utils::exception_container<exceptions::mutation_write_timeout_exception, exceptions::read_timeout_exception, exceptions::read_failure_exception, exceptions::rate_limit_exception>, utils::exception_container_throw_policy>, seastar::shared_ptr<cql_transport::messages::result_message::bounce_to_shard> > > (*)(service::client_state&, seastar::sharded<cql3::query_processor>&, cql_transport::request_reader, unsigned short, unsigned char, service_permit, tracing::trace_state_ptr, bool, std::unordered_map<unsigned char, std::optional<seastar::basic_sstring<signed char, unsigned int, 31u, false> >, std::hash<unsigned char>, std::equal_to<unsigned char>, std::allocator<std::pair<unsigned char const, std::optional<seastar::basic_sstring<signed char, unsigned int, 31u, false> > > > >)) at /tmp/transport/server.cc:992
cql_transport::cql_server::connection::process_query(unsigned short, cql_transport::request_reader, service::client_state&, service_permit, tracing::trace_state_ptr) at /tmp/transport/server.cc:1043
operator() at /tmp/transport/server.cc:462
 (inlined by) seastar::future<boost::outcome_v2::basic_result<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > >, utils::exception_container<exceptions::mutation_write_timeout_exception, exceptions::read_timeout_exception, exceptions::read_failure_exception, exceptions::rate_limit_exception>, utils::exception_container_throw_policy> > seastar::futurize<seastar::future<boost::outcome_v2::basic_result<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > >, utils::exception_container<exceptions::mutation_write_timeout_exception, exceptions::read_timeout_exception, exceptions::read_failure_exception, exceptions::rate_limit_exception>, utils::exception_container_throw_policy> > >::invoke<cql_transport::cql_server::connection::process_request_one(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)::$_2>(cql_transport::cql_server::connection::process_request_one(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)::$_2&&) at /tmp/./seastar/include/seastar/core/future.hh:2006
 (inlined by) auto seastar::futurize_invoke<cql_transport::cql_server::connection::process_request_one(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)::$_2>(cql_transport::cql_server::connection::process_request_one(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)::$_2&&) at /tmp/./seastar/include/seastar/core/future.hh:2037
 (inlined by) cql_transport::cql_server::connection::process_request_one(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit) at /tmp/transport/server.cc:428
seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > std::__invoke_impl<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > >, seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection::* const&)(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit), cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>(std::__invoke_memfun_deref, seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection::* const&)(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit), cql_transport::cql_server::connection*&&, fragmented_temporary_buffer::istream&&, unsigned char&&, unsigned short&&, service::client_state&, cql_transport::cql_server::connection::tracing_request_type&&, service_permit&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74
 (inlined by) std::__invoke_result<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection::* const&)(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit), cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>::type std::__invoke<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection::* const&)(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit), cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>(seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection::* const&)(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit), cql_transport::cql_server::connection*&&, fragmented_temporary_buffer::istream&&, unsigned char&&, unsigned short&&, service::client_state&, cql_transport::cql_server::connection::tracing_request_type&&, service_permit&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96
 (inlined by) decltype (std::__invoke((*this)._M_pmf, std::forward<cql_transport::cql_server::connection*>({parm#1}), std::forward<fragmented_temporary_buffer::istream>({parm#1}), std::forward<unsigned char>({parm#1}), std::forward<unsigned short>({parm#1}), std::forward<service::client_state&>({parm#1}), std::forward<cql_transport::cql_server::connection::tracing_request_type>({parm#1}), std::forward<service_permit>({parm#1}))) std::_Mem_fn_base<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection::*)(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit), true>::operator()<cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>(cql_transport::cql_server::connection*&&, fragmented_temporary_buffer::istream&&, unsigned char&&, unsigned short&&, service::client_state&, cql_transport::cql_server::connection::tracing_request_type&&, service_permit&&) const at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/functional:167
 (inlined by) seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>::direct_vtable_for<std::_Mem_fn<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection::*)(fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)> >::call(seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)> const*, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit) at /tmp/./seastar/include/seastar/util/noncopyable_function.hh:129
seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>::operator()(cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit) const at /tmp/./seastar/include/seastar/util/noncopyable_function.hh:215
 (inlined by) operator() at /tmp/./seastar/include/seastar/core/execution_stage.hh:342
 (inlined by) seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>::direct_vtable_for<seastar::inheriting_concrete_execution_stage<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > >, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>::make_stage_for_group(seastar::scheduling_group)::{lambda(cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)#1}>::call(seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)> const*, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit) at /tmp/./seastar/include/seastar/util/noncopyable_function.hh:129
seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>::operator()(cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit) const at /tmp/./seastar/include/seastar/util/noncopyable_function.hh:215
 (inlined by) seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > std::__invoke_impl<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > >, seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>(std::__invoke_other, seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, cql_transport::cql_server::connection*&&, fragmented_temporary_buffer::istream&&, unsigned char&&, unsigned short&&, service::client_state&, cql_transport::cql_server::connection::tracing_request_type&&, service_permit&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:61
std::__invoke_result<seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>::type std::__invoke<seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>(seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, cql_transport::cql_server::connection*&&, fragmented_temporary_buffer::istream&&, unsigned char&&, unsigned short&&, service::client_state&, cql_transport::cql_server::connection::tracing_request_type&&, service_permit&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96
 (inlined by) decltype(auto) std::__apply_impl<seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, std::tuple<cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>(seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, std::tuple<cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>&&, std::integer_sequence<unsigned long, 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul>) at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/tuple:1852
 (inlined by) decltype(auto) std::apply<seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, std::tuple<cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit> >(seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, std::tuple<cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>&&) at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/tuple:1863
 (inlined by) seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > seastar::futurize<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > >::apply<seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>(seastar::noncopyable_function<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > > (cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit)>&, std::tuple<cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>&&) at /tmp/./seastar/include/seastar/core/future.hh:1973
 (inlined by) seastar::concrete_execution_stage<seastar::future<seastar::foreign_ptr<std::unique_ptr<cql_transport::response, std::default_delete<cql_transport::response> > > >, cql_transport::cql_server::connection*, fragmented_temporary_buffer::istream, unsigned char, unsigned short, service::client_state&, cql_transport::cql_server::connection::tracing_request_type, service_permit>::do_flush() at /tmp/./seastar/include/seastar/core/execution_stage.hh:251
operator() at /tmp/./seastar/src/core/execution_stage.cc:149
 (inlined by) seastar::future<void> seastar::futurize<void>::invoke<seastar::execution_stage::flush()::$_1&>(seastar::execution_stage::flush()::$_1&) at /tmp/./seastar/include/seastar/core/future.hh:2003
 (inlined by) seastar::lambda_task<seastar::execution_stage::flush()::$_1>::run_and_dispose() at /tmp/./seastar/include/seastar/core/make_task.hh:45
seastar::reactor::run_tasks(seastar::reactor::task_queue&) at ./build/dev/seastar/./seastar/src/core/reactor.cc:2590
 (inlined by) seastar::reactor::run_some_tasks() at ./build/dev/seastar/./seastar/src/core/reactor.cc:3053
seastar::reactor::do_run() at ./build/dev/seastar/./seastar/src/core/reactor.cc:3222
seastar::reactor::run() at ./build/dev/seastar/./seastar/src/core/reactor.cc:3105
seastar::app_template::run_deprecated(int, char**, std::function<void ()>&&) at /tmp/./seastar/src/core/app-template.cc:276
seastar::app_template::run(int, char**, std::function<seastar::future<int> ()>&&) at /tmp/./seastar/src/core/app-template.cc:167
scylla_main(int, char**) at /tmp/main.cc:627
std::function<int (int, char**)>::operator()(int, char**) const at /usr/bin/../lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_function.h:591
main at /tmp/main.cc:2000
__libc_start_call_main at ??:?
__libc_start_main_alias_2 at :?
_start at ??:?

Scylla version (or git commit hash): Scylla 5.4.0~dev-0.20230714.033e5348aa82

@cvybhu
Copy link
Contributor Author

cvybhu commented Jul 14, 2023

The reason is the same as in #14705, the parser shouldn't allow it.

@cvybhu
Copy link
Contributor Author

cvybhu commented Jul 14, 2023

Fix:

diff --git a/cql3/Cql.g b/cql3/Cql.g
index 9249c49cb..06f35423e 100644
--- a/cql3/Cql.g
+++ b/cql3/Cql.g
@@ -461,8 +461,7 @@ orderByClause[raw::select_statement::parameters::orderings_type& orderings]
     ;
 
 jsonValue returns [expression value]
-    :
-    | s=STRING_LITERAL { $value = untyped_constant{untyped_constant::string, $s.text}; }
+    : s=STRING_LITERAL { $value = untyped_constant{untyped_constant::string, $s.text}; }
     | m=marker         { $value = std::move(m); }
     ;

@cvybhu
Copy link
Contributor Author

cvybhu commented Jul 14, 2023

The fix for this would conflict with the one in #14707, let's wait for it to be merged first.

cvybhu added a commit to cvybhu/scylladb that referenced this issue Jul 21, 2023
We allow inserting column values using a JSON value, eg:
```cql
INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}';
```

When no JSON value is specified, the query should be rejected.
Currently Scylla crashes in such cases, let's fix this.

This crashes Scylla:
```cql
INSERT INTO mytable JSON;
```

A unit test is added to prevent regressions.

Refs: scylladb#14707
Fixes: scylladb#14709

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
cvybhu added a commit to cvybhu/scylladb that referenced this issue Jul 21, 2023
We allow inserting column values using a JSON value, eg:
```cql
INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}';
```

When no JSON value is specified, the query should be rejected.

Scylla used to crash in such cases. A recent change fixed the crash
(scylladb#14706), it now fails
on unwrapping an uninitialized value, but really it should
be rejected at the parsing stage, so let's fix the grammar so that
it doesn't allow JSON queries without JSON values.

A unit test is added to prevent regressions.

Refs: scylladb#14707
Fixes: scylladb#14709

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>
patjed41 pushed a commit to patjed41/scylladb that referenced this issue Jul 27, 2023
We allow inserting column values using a JSON value, eg:
```cql
INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}';
```

When no JSON value is specified, the query should be rejected.

Scylla used to crash in such cases. A recent change fixed the crash
(scylladb#14706), it now fails
on unwrapping an uninitialized value, but really it should
be rejected at the parsing stage, so let's fix the grammar so that
it doesn't allow JSON queries without JSON values.

A unit test is added to prevent regressions.

Refs: scylladb#14707
Fixes: scylladb#14709

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>

Closes scylladb#14785
@DoronArazii DoronArazii added this to the 5.4 milestone Aug 29, 2023
avikivity pushed a commit that referenced this issue Sep 14, 2023
We allow inserting column values using a JSON value, eg:
```cql
INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}';
```

When no JSON value is specified, the query should be rejected.

Scylla used to crash in such cases. A recent change fixed the crash
(#14706), it now fails
on unwrapping an uninitialized value, but really it should
be rejected at the parsing stage, so let's fix the grammar so that
it doesn't allow JSON queries without JSON values.

A unit test is added to prevent regressions.

Refs: #14707
Fixes: #14709

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>

\Closes #14785

(cherry picked from commit cbc97b4)
avikivity pushed a commit that referenced this issue Sep 14, 2023
We allow inserting column values using a JSON value, eg:
```cql
INSERT INTO mytable JSON '{ "\"myKey\"": 0, "value": 0}';
```

When no JSON value is specified, the query should be rejected.

Scylla used to crash in such cases. A recent change fixed the crash
(#14706), it now fails
on unwrapping an uninitialized value, but really it should
be rejected at the parsing stage, so let's fix the grammar so that
it doesn't allow JSON queries without JSON values.

A unit test is added to prevent regressions.

Refs: #14707
Fixes: #14709

Signed-off-by: Jan Ciolek <jan.ciolek@scylladb.com>

\Closes #14785

(cherry picked from commit cbc97b4)
@avikivity
Copy link
Member

Backported to 5.1, 5.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants