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

CQL UUID parsing marshal error #1635

Closed
penberg opened this issue Aug 31, 2016 · 33 comments
Closed

CQL UUID parsing marshal error #1635

penberg opened this issue Aug 31, 2016 · 33 comments

Comments

@penberg
Copy link
Contributor

penberg commented Aug 31, 2016

Installation details
Scylla version (or git commit hash): 1.3

Scylla throws a marshal exception for the following UUID although it works fine in Cassandra:

CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'};
USE test;
CREATE TABLE IF NOT EXISTS breadshop (userID uuid primary key, type text, bread map<text, int>, cost float, rate double, time timestamp);
INSERT INTO breadshop (userid, type, bread, cost, rate, time) VALUES (80761BE4-C2E8-4329-A3BA-B6E0688CC775, 'Sandwitch', {'Chicken Roller': 3, 'Steak Roller': 7, 'Spicy Chicken Roller': 9}, 2.1, 9.1, dateof(now()));

Full backtrace:

#0  0x00007ffff724f39d in __cxa_throw () from /lib64/libstdc++.so.6
#1  0x0000000000bcff18 in uuid_type_impl::from_string (this=<optimized out>, s="80761BE4-C2E8-4329-A3BA-B6E0688CC775") at types.cc:803
#2  0x0000000000c7fe41 in cql3::constants::literal::parsed_value (this=this@entry=0x600000321820, validator=...) at cql3/constants.cc:76
#3  0x0000000000c80579 in cql3::constants::literal::prepare (this=0x600000321820, db=..., keyspace=..., receiver=...) at cql3/constants.cc:153
#4  0x0000000000aa6804 in cql3::statements::raw::insert_statement::prepare_internal (this=0x60000132a910, db=..., schema=..., bound_names=..., attrs=...) at cql3/statements/update_statement.cc:160
#5  0x0000000000a8efee in cql3::statements::raw::modification_statement::prepare (this=this@entry=0x60000132a910, db=..., bound_names=...) at cql3/statements/modification_statement.cc:589
#6  0x0000000000a8f77d in cql3::statements::raw::modification_statement::prepare (this=0x60000132a910, db=...) at cql3/statements/modification_statement.cc:578
#7  0x0000000000c86d48 in cql3::query_processor::get_statement (this=this@entry=0x6000000ac810, query="INSERT INTO breadshop (userID, type, rate, bread, time, cost) VALUES(80761BE4-C2E8-4329-A3BA-B6E0688CC775, 'Sandwich', 9.1, { 'Chicken Roller' : 3, 'Steak Roller' : 7, 'Spicy Chicken Roller' : 9 }, 14"..., 
    client_state=...) at cql3/query_processor.cc:288
#8  0x0000000000c86e43 in cql3::query_processor::process (this=0x6000000ac810, query_string="INSERT INTO breadshop (userID, type, rate, bread, time, cost) VALUES(80761BE4-C2E8-4329-A3BA-B6E0688CC775, 'Sandwich', 9.1, { 'Chicken Roller' : 3, 'Steak Roller' : 7, 'Spicy Chicken Roller' : 9 }, 14"..., query_state=..., 
    options=...) at cql3/query_processor.cc:119
#9  0x0000000000a01b4e in transport::cql_server::connection::process_query (this=0x600000047110, stream=<optimized out>, buf="", client_state=...) at transport/server.cc:783
#10 0x0000000000a0a818 in transport::cql_server::connection::<lambda()>::operator() (__closure=0x7fffffffb8b0) at transport/server.cc:509
#11 apply_helper<transport::cql_server::connection::process_request_one(bytes_view, uint8_t, uint16_t, service::client_state, transport::cql_server::connection::tracing_request_type)::<lambda()>, std::tuple<>&&, std::integer_sequence<long unsigned int> >::apply (args=<optimized out>, func=<optimized out>)
    at /home/penberg/scylla/seastar/core/apply.hh:34
#12 apply<transport::cql_server::connection::process_request_one(bytes_view, uint8_t, uint16_t, service::client_state, transport::cql_server::connection::tracing_request_type)::<lambda()> > (args=<optimized out>, func=<optimized out>) at /home/penberg/scylla/seastar/core/apply.hh:42
#13 futurize<future<std::pair<shared_ptr<transport::cql_server::response>, service::client_state> > >::apply<transport::cql_server::connection::process_request_one(bytes_view, uint8_t, uint16_t, service::client_state, transport::cql_server::connection::tracing_request_type)::<lambda()> > (args=<optimized out>, 
    func=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5ddba04>) at /home/penberg/scylla/seastar/core/future.hh:1211
#14 future<>::then<transport::cql_server::connection::process_request_one(bytes_view, uint8_t, uint16_t, service::client_state, transport::cql_server::connection::tracing_request_type)::<lambda()> > (func=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5e0e9a7>, this=0x7fffffffb710)
    at /home/penberg/scylla/seastar/core/future.hh:837
#15 transport::cql_server::connection::process_request_one (this=0x600000047110, buf="\000\000\000\332INSERT INTO breadshop (userID, type, rate, bread, time, cost) VALUES(80761BE4-C2E8-4329-A3BA-B6E0688CC775, 'Sandwich', 9.1, { 'Chicken Roller' : 3, 'Steak Roller' : 7, 'Spicy Chicken Roller' : 9 }"..., 
    op=<optimized out>, stream=<optimized out>, client_state=..., tracing_request=transport::cql_server::connection::tracing_request_type::not_requested) at transport/server.cc:481
#16 0x0000000000a0b8f3 in transport::cql_server::connection::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>::<lambda()>::<lambda()>::operator()(void) (__closure=__closure@entry=0x6000012cc800) at transport/server.cc:662
#17 0x0000000000a0d117 in futurize<future<std::pair<foreign_ptr<shared_ptr<transport::cql_server::response> >, service::client_state> > >::apply<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>::<lambda()> mutable::<lambda()>&> (func=...) at /home/penberg/scylla/seastar/core/future.hh:1221
#18 smp::submit_to<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>::<lambda()> mutable::<lambda()> > (
    func=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5e0a0cb>, t=0) at /home/penberg/scylla/seastar/core/reactor.hh:1065
#19 transport::cql_server::connection::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>::<lambda()>::operator() (__closure=0x7fffffffc580) at transport/server.cc:661
#20 seastar::with_gate<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>::<lambda()> > (
    func=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5e5ff08>, g=...) at /home/penberg/scylla/seastar/core/gate.hh:120
#21 transport::cql_server::connection::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>::operator() (__closure=0x7fffffffcb00, __closure=0x7fffffffcb00, __closure=0x7fffffffcb00, __closure=0x7fffffffcb00, 
    __closure=0x7fffffffcb00, buf=<error reading variable: access outside bounds of object referenced via synthetic pointer>) at transport/server.cc:658
#22 apply_helper<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>, std::tuple<temporary_buffer<char> >&&, std::integer_sequence<long unsigned int, 0ul> >::apply (
    args=args@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5c20ee1>, func=func@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5dd3e2f>) at /home/penberg/scylla/seastar/core/apply.hh:34
#23 apply<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>, temporary_buffer<char> > (args=<optimized out>, func=<optimized out>)
    at /home/penberg/scylla/seastar/core/apply.hh:42
#24 futurize<future<> >::apply<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)>, temporary_buffer<char> >(<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5dcc2ea>, <unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5c20ee1>) (func=func@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5dcc2ea>, 
    args=args@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5c20ee1>) at /home/penberg/scylla/seastar/core/future.hh:1211
#25 0x0000000000a0f433 in future<temporary_buffer<char> >::then<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::<lambda(temporary_buffer<char>)> > (
    func=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5e099f3>, this=0x7fffffffcc10) at /home/penberg/scylla/seastar/core/future.hh:837
#26 transport::cql_server::connection::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>::operator() (__closure=__closure@entry=0x7fffffffca60) at transport/server.cc:682
#27 apply_helper<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()>, std::tuple<>&&, std::integer_sequence<long unsigned int> >::apply (args=<optimized out>, func=<optimized out>)
    at /home/penberg/scylla/seastar/core/apply.hh:34
#28 apply<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()> > (args=<optimized out>, func=<optimized out>) at /home/penberg/scylla/seastar/core/apply.hh:42
#29 futurize<future<> >::apply<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()> >(<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5d96324>, <unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5c1a59a>) (func=func@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5d96324>, args=<optimized out>) at /home/penberg/scylla/seastar/core/future.hh:1211
#30 0x0000000000a101d8 in future<>::then<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()> > (func=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5dcc109>, 
    this=0x7fffffffcce0) at /home/penberg/scylla/seastar/core/future.hh:837
#31 with_semaphore<semaphore_default_exception_factory, transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::<lambda()> > (
    func=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5e098e4>, units=8450, sem=...) at /home/penberg/scylla/seastar/core/semaphore.hh:319
#32 transport::cql_server::connection::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>::operator() (v=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5cbf22d>, __closure=0x6000012fe040) at transport/server.cc:682
#33 futurize<future<> >::apply<transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>, future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> > >(<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5dc89bb>, <unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5cbf22d>) (func=func@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5dc89bb>, 
    args#0=args#0@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5cbf22d>) at /home/penberg/scylla/seastar/core/future.hh:1221
#34 0x0000000000a1779e in future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >::<lambda(auto:2&&)>::operator()<future_state<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> > > (
    state=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x5a83699, DIE 0x5cbefad>, __closure=0x6000012fe020) at /home/penberg/scylla/seastar/core/future.hh:886
#35 continuation<future<T>::then_wrapped(Func&&) [with Func = transport::cql_server::connection::process_request()::<lambda(future<std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >&&)>; Result = future<>; T = {std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3>}]::<lambda(auto:2&&)>, std::experimental::fundamentals_v1::optional<transport::cql_binary_frame_v3> >::run(void) (this=0x6000012fe000) at /home/penberg/scylla/seastar/core/future.hh:389
#36 0x000000000048f3b9 in reactor::run_tasks (this=this@entry=0x6000002a2000, tasks=...) at core/reactor.cc:1896
#37 0x00000000004c79eb in reactor::run (this=0x6000002a2000) at core/reactor.cc:2316
#38 0x00000000005453f4 in app_template::run_deprecated(int, char**, std::function<void ()>&&) (this=this@entry=0x7fffffffd9e0, ac=ac@entry=12, av=av@entry=0x7fffffffdc58, func=func@entry=<unknown type in /home/penberg/scylla/build/release/scylla, CU 0x744bf6, DIE 0x80b643>) at core/app-template.cc:131
#39 0x0000000000420f32 in main (ac=12, av=0x7fffffffdc58) at main.cc:662

Spotted by https://github.com/IBM-Swift/Kassandra tests.

@avikivity
Copy link
Member

It's in fact illegal according to https://en.wikipedia.org/wiki/Universally_unique_identifier.

@penberg
Copy link
Contributor Author

penberg commented Aug 31, 2016

@avikivity It doesn't matter, it's what Cassandra supports.

@avikivity
Copy link
Member

Of course.

@penberg
Copy link
Contributor Author

penberg commented Aug 31, 2016

@avikivity What's invalid about it? It passes some random UUID validator (http://www.uuid-validator.com/), which claims it's "version 4" UUID.

@avikivity
Copy link
Member

Right.

@penberg
Copy link
Contributor Author

penberg commented Aug 31, 2016

@avikivity So the UUID doesn't pass the regexp validation phase but I don't really understand why. The regular expression itself looks OK to me.

@avikivity
Copy link
Member

Maybe need to enable some enhanced mode for {}. Or maybe the - is some unicode char.

@penberg
Copy link
Contributor Author

penberg commented Aug 31, 2016

No unicode chars and no references to having to enable {} quantifiers. Let's ask help from @pdziepak and @tgrabiec who know everything.

@tgrabiec
Copy link
Contributor

from_string looks like this:

virtual bytes from_string(sstring_view s) const override {
        if (s.empty()) {
            return bytes();
        }
        static const std::regex re("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$");
        if (!std::regex_match(s.data(), re)) {
            throw marshal_exception();
        }

s.data() returns just a char pointer and the invoked std::regex_match() overload will treat it as a null-terminated string. string_view doesn't guarantee that the string is null-terminated so I think we should fix the code to invoke the overload which takes both start and end pointers.

That doesn't explain the error though because the backtrace suggests that the string_view is constructed from literal::_text which is an sstring and it should ensure that the string is null-terminated. Maybe we hit some corner case which caused the trailing null to be stripped? Could you check that this is the case using gdb?

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

@tgrabiec, nice catch about s.data() not being zero-terminated.

This patch makes the problem go away:

diff --git a/types.cc b/types.cc
index 12104d8..3c29fec 100644
--- a/types.cc
+++ b/types.cc
@@ -799,7 +799,7 @@ struct uuid_type_impl : concrete_type<utils::UUID> {
             return bytes();
         }
         static const std::regex re("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$");
-        if (!std::regex_match(s.data(), re)) {
+        if (!std::regex_match(std::string{s.data(), s.length()}, re)) {
             throw marshal_exception();
         }
         utils::UUID v(s);

What is it exactly that you want me to check? When we get to uuid_type_impl::from_string the underlying buffer for string_view doesn't look like to be zero-terminated:

Thread 1 "scylla" hit Breakpoint 2, uuid_type_impl::from_string (this=0x60000012b860, s="80761BE4-C2E8-4329-A3BA-B6E0688CC775") at types.cc:797
797     virtual bytes from_string(sstring_view s) const override {
(gdb) print s
$1 = "80761BE4-C2E8-4329-A3BA-B6E0688CC775"
(gdb) print s._M_len 
$2 = 36
(gdb) print s._M_str 
$3 = 0x6000012fd410 "80761BE4-C2E8-4329-A3BA-B6E0688CC775"

@tgrabiec
Copy link
Contributor

tgrabiec commented Sep 1, 2016

@penberg It would be more efficient to avoid the copy, like this: std::regex_match(s.begin(), s.end(), re)

The sstring_view contents itself will not include the null terminator, but it should follow it immediately if it is created from an sstring instance. So s.data()[s.len()] should be zero. We should check if lack of null terminator is what's causing regex mismatch because it means we have another bug in sstring. sstring::c_str() relies on the terminator to be always following the data.

@avikivity
Copy link
Member

_text is even const, very strange.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

@tgrabiec Interestingly enough, std::regex_match(s.begin(), s.end(), re) also doesn't work 😄

@avikivity
Copy link
Member

_text is constructed by moving/copying sstrings that were initially constructed from an std::string. The entire path looks correct.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

...and the failure disappears with debug build (no ASan warnings either).

@tgrabiec
Copy link
Contributor

tgrabiec commented Sep 1, 2016

@penberg then maybe we have use-after-free or concurrent modification of the storage underlying s. Copying could help by narrowing down the access time window.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

@tgrabiec Like I said, no ASan errors, so unlikely to be use-after-free.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

Also, if you look at the lifetime of buf returned by read_and_decompress_frame() in cql_server::connection::process_request, the data is kept live until request processing is complete. So I don't really see how concurrent modification could happen either.

@tgrabiec
Copy link
Contributor

tgrabiec commented Sep 1, 2016

@penberg in release build, does it reproduce for you every time, using cqlsh and the statements you gave in the description? I can't reproduce the failure here. Maybe it's related to gcc/libc version.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

@tgrabiec It's always reproducible with the release build.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

I'm on Fedora 24:

[penberg@nero scylla]$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/6.1.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 6.1.1 20160621 (Red Hat 6.1.1-3) (GCC) 

@avikivity
Copy link
Member

Maybe we're violating -fstrict-aliasing again.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

OK, so the hypothesis about the string not being zero-terminated is false:

(gdb) print s._M_str 
$3 = 0x60000136ff50 "80761BE4-C2E8-4329-A3BA-B6E0688CC775"
(gdb) x/37b 0x60000136ff50
0x60000136ff50: 0x38    0x30    0x37    0x36    0x31    0x42    0x45    0x34
0x60000136ff58: 0x2d    0x43    0x32    0x45    0x38    0x2d    0x34    0x33
0x60000136ff60: 0x32    0x39    0x2d    0x41    0x33    0x42    0x41    0x2d
0x60000136ff68: 0x42    0x36    0x45    0x30    0x36    0x38    0x38    0x43
0x60000136ff70: 0x43    0x37    0x37    0x35    0x00

Also, just to make sure std::regex_match is fine:

[penberg@nero tmp]$ cat regex.cc 
#include <iostream>
#include <string>
#include <regex>

int main()
{
    std::string s = "80761BE4-C2E8-4329-A3BA-B6E0688CC775";
    static const std::regex re("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$");
    if (!std::regex_match(s.data(), re)) {
        std::cout << "FAIL: no match" << std::endl;
    } else {
        std::cout << "PASS" << std::endl;
    }
}
[penberg@nero tmp]$ g++ -O3 -Wall -std=c++17 regex.cc && ./a.out 
PASS

@tgrabiec
Copy link
Contributor

tgrabiec commented Sep 1, 2016

What if you use sstring and sstring_view instead of std::string?

@avikivity
Copy link
Member

Can you check zero termination in Scylla? The test program has different code paths.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

@avikivity That gdb session was from Scylla.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

No warnings from -fstrict-aliasing:

diff --git a/configure.py b/configure.py
index b54f72d..eb17b76 100755
--- a/configure.py
+++ b/configure.py
@@ -614,6 +614,7 @@ deps['tests/anchorless_list_test'] = ['tests/anchorless_list_test.cc']
 warnings = [
     '-Wno-mismatched-tags',  # clang-only
     '-Wno-maybe-uninitialized', # false positives on gcc 5
+    '-fstrict-aliasing',
     ]

 warnings = [w

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

Oh, -fstrict-aliasing wasn't a warning, but an optimization flag. Well, it makes the problem go away :-/

@avikivity
Copy link
Member

-fstrict-laliasing is the default, and it makes problems appear, not disappear.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

Uhm, yes, I do understand that's the way it should be. But it's not.

Problem disappears with:

diff --git a/configure.py b/configure.py
index b54f72d..16f9afc 100755
--- a/configure.py
+++ b/configure.py
@@ -614,6 +614,8 @@ deps['tests/anchorless_list_test'] = ['tests/anchorless_list_test.cc']
 warnings = [
     '-Wno-mismatched-tags',  # clang-only
     '-Wno-maybe-uninitialized', # false positives on gcc 5
+    '-fstrict-aliasing',
+    '-Wstrict-aliasing',
     ]

 warnings = [w

I suppose I need to rebuild yet again to see if I am able to reproduce with a clean build...

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

Blah. The issue is no longer reproducible. I suspect what happened was that I had not cleaned up seastar/build after upgrading to Fedora 24, which lead to the odd behavior I saw.

@penberg penberg closed this as completed Sep 1, 2016
@avikivity
Copy link
Member

Well, different gcc versions ought to generate interoperable code.

@penberg
Copy link
Contributor Author

penberg commented Sep 1, 2016

Yeah? I would have assumed all of them have to follow some ABI... Anyway, I really wanted a clean build but simply forgot to nuke Seastar build artifacts.

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

No branches or pull requests

3 participants