Comments (9)
Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).
Thanks for your report.
There aren't any incompatibilities between the 'pg' gem and PostgreSQL 9.0.x that I know of (that's the combination I use in production), but I haven't tested on Debian in particular.
Your backtrace leads me to believe that if there is something segfaulting in pg, that it's being caused by a connection argument, but of course I can't see what arguments are being passed to the constructor. It would help a lot if you could reduce this to a test case outside of Rails/ActiveRecord. For example, dump out @connection_parameters
before line 987 in postgresql_adapter.rb
, then test them in this code:
#!ruby
@connection_parameters = [ ...the dumped parameters from above...]
p PGconn.connect( *@connection_parameters )
If that segfaults, then that's at least something I can run on my machine without having to install Rails and duplicate your app and runtime environment. If it doesn't then that's good information, too.
from ruby-pg.
Original comment by Florent Monbillard (Bitbucket: EppO, GitHub: EppO).
Hello, thanks for your support, sorry for the delay, no bitbucket account, no notification...
I tried what you said, there is no segfault when I do only:
#!ruby
require 'pg'
conn_params = ["127.0.0.1", 5432, nil, nil, "redmine", "redmine", "password1234567890"]
PGconn.connect(*conn_params)
I only have pg 0.11.0 installed so I think it's the same version than redmine is using with active_record.
from ruby-pg.
Original comment by Florent Monbillard (Bitbucket: EppO, GitHub: EppO).
any idea on this ? is this a debian bug, an activerecord bug or a pg bug ? How can I help to diagnose it ?
from ruby-pg.
Original comment by Anonymous.
In case it helps - I was having a segmentation fault on the pg gem when trying to create a connection via HTTP.
There is an issue with OpenSSL using the MacPorts installation of Postgres (and Mysql). I killed MacPorts, switched to Homebrew and it's all working now.
from ruby-pg.
Original comment by Florent Monbillard (Bitbucket: EppO, GitHub: EppO).
Thanks for the hint but it doesn't help, I use Debian Linux here.
from ruby-pg.
Original comment by Florent Monbillard (Bitbucket: EppO, GitHub: EppO).
I successfully made it segfault adding openssl before requiring pg gem:
#!ruby
require 'openssl'
require 'pg'
conn_params = ["127.0.0.1", 5432, nil, nil, "redmine", "redmine", "password1234567890"]
PGconn.connect(*conn_params)
It does:
#!console
# ruby segfault.rb
segfault.rb:5: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
-- control frame ----------
c:0005 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC :initialize
c:0004 p:---- s:0017 b:0017 l:000016 d:000016 CFUNC :new
c:0003 p:0061 s:0007 b:0007 l:0021fc d:002028 EVAL segfault.rb:5
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0021fc d:0021fc TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
segfault.rb:5:in `<main>'
segfault.rb:5:in `new'
segfault.rb:5:in `initialize'
-- C level backtrace information -------------------------------------------
/home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_vm_bugreport+0x72) [0xb7819ac2]
/home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x56271) [0xb76f3271]
/home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(rb_bug+0x3a) [0xb76f336a]
/home/eppo/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.so.1.9(+0x10851c) [0xb77a551c]
[0xb788e40c]
[(nil)]
[0x41]
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
zsh: abort ruby segfault.rb
I guess it's a conflict between openssl library and the pg gem but what is the workaround ?
from ruby-pg.
Original comment by Florent Monbillard (Bitbucket: EppO, GitHub: EppO).
Please note that if I require the openssl gem //after// the pg gem, it works...
from ruby-pg.
Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).
It's not a conflict between openssl and the pg library, it's a conflict between two versions of the openssl library -- the one your Ruby was compiled with, and the one your libpq was compiled with.
The solution is to compile both Ruby and libpq with the same version of openssl, and then not upgrade it without re-compiling. When you load a different version of the library than it was compiled against, and its interface changes at all, you get problems like this. That's one of the perils of compiling stuff yourself, or using tools that do it for you without being aware of other dependencies. It falls on your to be aware of these dependencies yourself.
This ticket is a duplicate of <<issue 77>>, so I'm closing it, but I'll try to figure out a way of detecting this problem at compile time since it seems prevalent, especially with the rising popularity of rvm.
from ruby-pg.
Original comment by Anonymous.
@michael Granger
+1
Thanks for explanation.
Quick Solution:
http://stackoverflow.com/a/11452588/418518
from ruby-pg.
Related Issues (20)
- Segmentation fault HOT 28
- Sonoma: getaddrinfo segmentation fault HOT 2
- Segmentation fault in ruby:3.2.2-alpine3.18 docker image HOT 2
- Wrong binary conversion on x86 (32bit intel) arch causing test failures HOT 4
- Bad IAM Token against Amazon Aurora Postgres: Out of memory error HOT 2
- Attempting to execute a sql file with `\set ...` raises errors HOT 3
- conn.exec writing "INFO" statements to stderr instead of stdout HOT 2
- Segfault on ruby 3.2.2, pg 1.5.4 HOT 2
- Error ruby(39749,0x1e1f05300) malloc: double free for ptr 0x13c6bfa00 HOT 1
- Segmentation fault when connecting to RDS HOT 11
- Broken links in documentation HOT 3
- connection.reset don't check again DNS HOT 6
- Usage with ApacheAGE for Postgresql HOT 2
- Add BigDecimal to gemspec for Ruby 3.3/4 HOT 2
- Binary Windows gem no longer available for Ruby v3.3 since v1.5.6 HOT 2
- Test failure with modified `RUBY_PG_TEST_DIR` HOT 2
- Q: Is it possible to handle composite values like `row(123, 'str', true)` ? HOT 1
- Dereference of null in alloc_query_params HOT 1
- TypeError PG::TypeMap undefined method `key?' for nil if !type_map.key?(oid) HOT 2
- Query hangs when using async_exec HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-pg.