# Segmentation Fault in httpclient 2.1.0

**URL:** <https://www.ruby-forum.com/t/segmentation-fault-in-httpclient-2-1-0/111220>\
**Category:** Ruby\
**Created:** [August 3, 2007, 10:55pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-httpclient-2-1-0/111220 "2007-08-03T22:55:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [August 3, 2007, 10:55pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-httpclient-2-1-0/111220/1 "2007-08-03T22:55:08Z")

</div>

I’ve written a ruby script that connects to a web service running  
within our intranet via Soap4r. I developed the script on a Mac (OS  
10.4.10, ruby 1.8.6 patch 0, soap4r 1.5.7, httpclient 2.1.0, net-ssh  
1.1.2) and I have no problems on my machine. However when we deploy  
the script to the production environment (a linux box with the same  
ruby version and gems as I have on my development machine), we get  
random segmentation faults:

/usr/local/lib/ruby/gems/1.8/gems/httpclient-2.1.0/lib/httpclient.rb:378  
: [BUG] Segmentation fault  
ruby 1.8.6 (2007-03-13) [i686-linux]

Aborted  
-bash-2.05b$ echo $?  
134

Here’s the code where the seg fault occurs:  
353 def load\_cacerts  
354 file = File.join(File.dirname( **FILE** ), ‘httpclient’,  
‘cacert.p7s’)  
355 if File.exist?(file)  
356 require ‘openssl’  
357 dist\_cert =\<\< **DIST\_CERT**  
…  
377\_\_DIST\_CERT\_\_  
378 p7 = OpenSSL::PKCS7.read\_smime(File.open(file) { |f| f.read })

The last line is where things die.

Has anyone else seen this problem? What version of OpenSSL should we  
be running for compatibility with Ruby’s OpenSSL library?

Any suggests on how to fix this would be much appreciated, since we  
can’t roll these scripts out with these errors.

Thank you,

Mark

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [August 4, 2007, 4:07pm UTC](https://www.ruby-forum.com/t/segmentation-fault-in-httpclient-2-1-0/111220/2 "2007-08-04T16:07:27Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

Mark S. wrote:

> Has anyone else seen this problem? What version of OpenSSL should we be  
> running for compatibility with Ruby’s OpenSSL library?

You need to use the openssl version that matches with the openssl header  
files which are used when the ruby was compiled. Check the environment.

Regards,  
// NaHi

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2.1 (Cygwin)

iQEVAwUBRrSHuR9L2jg5EEGlAQLfiAf/ZhuZDFRIR/uMxVO7O2wuZkJ/e1VsAeSE  
3vd9I6n4KpIMlUFX5B8pi+A73HOJPB5N0ZlrY/y0OdbrGzOegLSqga5G9iWiOWWw  
RjXuLPh0GIRKkr5TL7SxVLXEyiWoC9gy3Rg/SPrJfAuBWQvcu3kpo4k6A3vxwZZF  
fQgozabeM9iGhLfXz4lqTkXlXD6/+HcNcJSpvGB/SK9bfvdLdqLsmt2r43+Yvn7H  
YXq7i82d1CAMYl6vXD0mD76SFV83FbA1XaiGkkdxGbnKt3gmnAzjX29t3j5k4crD  
gPaBto73cr34Jp7JQvwcYM0GuWM/Rh6mTZKO39X4jpY5iL+rX0RpLw==  
=PUTF  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [August 15, 2007, 3:21am UTC](https://www.ruby-forum.com/t/segmentation-fault-in-httpclient-2-1-0/111220/3 "2007-08-15T03:21:26Z")

</div>

That doesn’t seem to be the problem. We’ve found that with OpenSSL  
0.9.7, we get random segmentation faults. If we upgrade to 0.9.8,  
they go away. In each case, we’ve rebuilt ruby so the headers always  
matched the library.

Mark
