You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, Simone gave me a dump, and when I import that dump and insert it the same way he did, I don't get the same error. I had to translate the dump from a SQL dump, though, so it's possible I messed something up during that step.
I trespassed further on Simone's generosity and asked whether he'd be able to provide a standalone script that reproduces the problem for him, since it might be something subtle. If he's willing to do that, and I still can't reproduce it, pair-programming the problem or just handing it off to a fresh set of eyes might be a good idea.
I was under the impression from the google group that the bug occured while inserting into an empty table, so getting the rethinkdb_data might not be too helpful.
My other though was that it might be the CentOS build.
@simo2409 -- just to check, does the bug occur when you're inserting into an empty table in a fresh RethinkDB instance? If not, would you be willing to provide us with your rethinkdb_data directory?
Yes, I have 1 db (not "test", I created a new one) with 1 table, on each try I did:
1 - delete old table (so the db was empty)
2 - create a new table
3 - try to insert documents -> got error
In the while I re-wrote the import script (to be a normal ruby script and not a rake task so Michael can try to reproduce the problem) and I sent it to Michael (sorry but I can't put it here for privacy (data is dummy but the db structure is real)
Good news (more or less), I compiled RethinkDB 1.7.1 from sources and insert works without any problem, so I believe it's a problem with the CentOS build
I was wrong sorry, I did another try and the problem still persists (even on self-compiled RethinkDB) but I think to understood the problem.
I try to repeat everything to make it clear:
1 - I installed RethinkDB from CentOS build and I started 2 instances => Error
2 - I compiled RethinkDB from sources and I started 1 instance => Works
3 - Still using RethinkDB from sources, I started 2 instances => Error
So this makes me think that the problem appears only when there are 2 instances connected.
2 instances are connected but 1 is completely un-used (db has only 1 shard in total and there is no replication setup)
@simo2409 sent me a script that reliably reproduces the bug for him when run against two release CentOS servers from a client running on Ruby 1.9 on OS X.
I am unable to reproduce the bug when running against two release Ubuntu servers from a client running Ruby 1.9 on OS X.
The next logical step is to test against a CentOS build.
@AtnNn or @neumino -- do you happen to have a CentOS build of 1.7 / a CentOS VM lying around?
@mlucy, I have a CentOS virtualbox VM running on my workstation if you want to grab it. It has rethinkdb next building, so it should be pretty easy to build/run whatever. Feel free to save state and copy it wherever.
Alright, I think I've tracked this down. (I'll grab Etienne tomorrow and test my theory.)
The bug occurs when a query is handled on a different server than the one storing the data. We turn the insert into a batched_replaces_t and serialize it over the network. The batched_replaces_t contains an std::vector<std::pair<int64_t, point_replace_t> >. The point_replace_t contains a wire_func_t nested deep inside it.
The deserialization function for wire_datum_t assumed that each wire_datum_t would be default-constructed before rdb_serialize was called on it. (Copying it is legal, but only after it's been initialized.) If this isn't the case, we end up with two separate wire_func_t objects that share pointers to the same Term in sourcebefore either one has been deserialized. Shenanigans ensue.
This is easy(ish) to fix. I'll do it tomorrow once I get a working CentOS build environment to test whether it fixes the problem.
So, I'm currently blocked on the extremely embarrassing problem of not being able to compile RethinkDB on CentOS. I plan to grab Etienne on Monday and study at the feet of the devops master.
@simo2409 -- thanks again for reporting this, and being so patient while we tracked it down! We should hopefully have this fix out in a point release next week.
Activity
mlucy commentedon Jul 10, 2013
The current state of this is that I'm having trouble reproducing.
coffeemug commentedon Jul 10, 2013
Do you want to pair-reproduce this?
mlucy commentedon Jul 10, 2013
So, Simone gave me a dump, and when I import that dump and insert it the same way he did, I don't get the same error. I had to translate the dump from a SQL dump, though, so it's possible I messed something up during that step.
I trespassed further on Simone's generosity and asked whether he'd be able to provide a standalone script that reproduces the problem for him, since it might be something subtle. If he's willing to do that, and I still can't reproduce it, pair-programming the problem or just handing it off to a fresh set of eyes might be a good idea.
coffeemug commentedon Jul 10, 2013
Would he be able to provide a tar.gz of a rethinkdb_data directory? That might help (sorry for butting in)
mlucy commentedon Jul 10, 2013
I was under the impression from the google group that the bug occured while inserting into an empty table, so getting the
rethinkdb_datamight not be too helpful.My other though was that it might be the CentOS build.
mlucy commentedon Jul 10, 2013
@simo2409 -- just to check, does the bug occur when you're inserting into an empty table in a fresh RethinkDB instance? If not, would you be willing to provide us with your
rethinkdb_datadirectory?simo2409 commentedon Jul 10, 2013
Yes, I have 1 db (not "test", I created a new one) with 1 table, on each try I did:
1 - delete old table (so the db was empty)
2 - create a new table
3 - try to insert documents -> got error
simo2409 commentedon Jul 10, 2013
If it can be useful I can try to remove RethinkDB (from CentOS build), compile it from sources and re-try to insert
simo2409 commentedon Jul 10, 2013
In the while I re-wrote the import script (to be a normal ruby script and not a rake task so Michael can try to reproduce the problem) and I sent it to Michael (sorry but I can't put it here for privacy (data is dummy but the db structure is real)
simo2409 commentedon Jul 10, 2013
Good news (more or less), I compiled RethinkDB 1.7.1 from sources and insert works without any problem, so I believe it's a problem with the CentOS build
simo2409 commentedon Jul 11, 2013
I was wrong sorry, I did another try and the problem still persists (even on self-compiled RethinkDB) but I think to understood the problem.
I try to repeat everything to make it clear:
1 - I installed RethinkDB from CentOS build and I started 2 instances => Error
2 - I compiled RethinkDB from sources and I started 1 instance => Works
3 - Still using RethinkDB from sources, I started 2 instances => Error
So this makes me think that the problem appears only when there are 2 instances connected.
2 instances are connected but 1 is completely un-used (db has only 1 shard in total and there is no replication setup)
simo2409 commentedon Jul 11, 2013
Last test, I re-installed RethinkDB from CentOS build, running only 1 instance => Works
So it seems to be a problem when there are 2 instances running on the same box
mlucy commentedon Jul 11, 2013
Ah! I'll try with 2 instances, thanks @simo2409 .
coffeemug commentedon Jul 11, 2013
@simo2409 I wanted to chime in and thank you for your patience in isolating this bug. It helps improve the product immensely. If you'd be kind enough to fill out http://rethinkdb.com/community/cla/, we'll send you a little something for it!
mlucy commentedon Jul 11, 2013
So, here's an update:
The next logical step is to test against a CentOS build.
@AtnNn or @neumino -- do you happen to have a CentOS build of 1.7 / a CentOS VM lying around?
AtnNn commentedon Jul 11, 2013
@mlucy you can extract the binary from the rpm by doing
alien --to-tgzand thentar xf. You should be able to run the binary it on newton.Tryneus commentedon Jul 11, 2013
@mlucy, I have a CentOS virtualbox VM running on my workstation if you want to grab it. It has rethinkdb next building, so it should be pretty easy to build/run whatever. Feel free to save state and copy it wherever.
mlucy commentedon Jul 11, 2013
@AtnNn -- where's the RPM?
AtnNn commentedon Jul 11, 2013
http://download.rethinkdb.com/centos/6/
mlucy commentedon Jul 11, 2013
Good news -- this reproduces with the CentOS binary!
mlucy commentedon Jul 11, 2013
Alright, I think I've tracked this down. (I'll grab Etienne tomorrow and test my theory.)
The bug occurs when a query is handled on a different server than the one storing the data. We turn the insert into a
batched_replaces_tand serialize it over the network. Thebatched_replaces_tcontains anstd::vector<std::pair<int64_t, point_replace_t> >. Thepoint_replace_tcontains awire_func_tnested deep inside it.The problem comes from the interaction of the deserialization functions for
std::vectorandwire_func_t. The deserialization function forstd::vectorcallsresizeto size the vector appropriately. As far as I can tell (and this seems wacky to me), when you resize a vector to a larger size, the CentOS build invokes the default constructor to build a reference object, then uses the copy constructor to move copies of it into all the new positions. Cursory googling (http://stackoverflow.com/questions/7413876/does-the-vector-resize-method-calls-the-default-elements-contructors-when-resi) seems to suggest that this is legal.The deserialization function for
wire_datum_tassumed that eachwire_datum_twould be default-constructed beforerdb_serializewas called on it. (Copying it is legal, but only after it's been initialized.) If this isn't the case, we end up with two separatewire_func_tobjects that share pointers to the sameTerminsourcebefore either one has been deserialized. Shenanigans ensue.This is easy(ish) to fix. I'll do it tomorrow once I get a working CentOS build environment to test whether it fixes the problem.
mlucy commentedon Jul 13, 2013
So, I'm currently blocked on the extremely embarrassing problem of not being able to compile RethinkDB on CentOS. I plan to grab Etienne on Monday and study at the feet of the devops master.
neumino commentedon Jul 13, 2013
@mlucy instructions are here:
#938 (comment)
You don't have to install the npm dependencies though.
(or in the branch michel_update_all of the website)
mlucy commentedon Jul 13, 2013
Go this building -- thanks @neumino .
mlucy commentedon Jul 13, 2013
This is in review 736 by @jdoliner . (I tested it with a CentOS build, and it seems to make the problem go away.)
mlucy commentedon Jul 13, 2013
@simo2409 -- thanks again for reporting this, and being so patient while we tracked it down! We should hopefully have this fix out in a point release next week.
simo2409 commentedon Jul 13, 2013
Great to hear it! Thank you!
mlucy commentedon Jul 16, 2013
This is in next and v1.7.x.
@AtnNn -- could we do a point release this week?