datamapper / do

DataObjects
147 stars 74 forks source link

Segmentation fault in data_objects on new hosting (Nginx+Passenger) #56

Closed crantok closed 11 years ago

crantok commented 11 years ago

I've just tried moving my Sinatra app to new hosting. The environment:

DataMapper seems to access the database okay. (If I deliberately use a bad password then I get an error message saying MySQL denied access to the user.) And I can define my models, but the first time I try to access any data in the DB (e.g. by MyModel.count) I get a segmentation fault.

/home/myuser/webapps/myapp/gems/gems/data_objects-0.10.12/lib/data_objects/connection.rb:79: [BUG] Segmentation fault

Does this look like data_object's problem? (Sorry if that's a dumb question. I haven't encountered a segmentation fault in Ruby before.) What other information would be useful for me to supply here?

This app works on my previous hosting and on my laptop but I'm using Thin rather than Passenger on those systems.

godfat commented 11 years ago

I am running ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.2.1] and seeing a segfault after doing a select with ALTER TABLE with postgres as well.

But it looks to me it's more a Ruby bug since it segfaulted at lines in Ruby code instead of native code. However it's actually hard to tell. I don't yet have time to figure out what's going on, but want to let people know we have similar issues. (though it might not be related)

dbussink commented 11 years ago

Could any one of you create a small repro for this to reproduce the problem? Ideally just a script with no dependencies except for DataObjects itself. I'm sure it would be fairly easy to fix then.

crantok commented 11 years ago

@dbussink I'll try to do that tomorrow morning (I'm in the UK) and post a link here. This is my first DataMapper app and I'm relatively new to Ruby. If I get stuck then I'll mention that here too.

godfat commented 11 years ago

Here it is. https://gist.github.com/godfat/5626115 So it looks like it crashed at execute_reader which is a C function.

godfat commented 11 years ago

Could it be a postgres change? I am using psql --version psql (PostgreSQL) 9.2.4

crantok commented 11 years ago

I've uploaded a script that's based on godfat's. https://gist.github.com/crantok/5626645

One thing I forgot: Server version: 5.5.30-30.1 Percona Server (GPL), Release rel30.1, Revision 465

dbussink commented 11 years ago

@crantok Looks like your issue is a different one from @godfat, they don't seem to be related. I've managed to reproduce the issue of @godfat, but the one @crantok reported seems to run fine for me.

crantok commented 11 years ago

That's a pity. Any idea what my next step should be? I wonder whether it's worth pointing my host's support at this thread.

dbussink commented 11 years ago

I don't know if it's possible to set up a machine somewhere that shows this problem? If you could get this crash reproduced in for example an isolated virtual machine that I could get access to, that would be great. That's probably the easiest way to get the information needed to fix this issue.

crantok commented 11 years ago

Providing a VM is beyond my abilities. I've raised a ticket with my host to see if they can help in this regard.

crantok commented 11 years ago

I've found out that there was a problem with the gem installation on my hosting account. Reinstallation killed the problem so my original issue was a phantom. I haven't closed the issue in case you still need it open for the postgres segfault.

dbussink commented 11 years ago

Ah, I'm closing it then, since the postgres segfault was fixed.