Project

General

Profile

Bug #2319

gethostbyname fails in windows

Added by rogerdpack (Roger Pack) over 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-10-26 trunk 25491) [i386-mingw32]
Backport:
[ruby-core:26458]

Description

=begin
Unfortunately this appears to prevent me from running other tests...

C:\dev\ruby\downloads\ruby_trunk>make test-all
./miniruby.exe -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./tool/runruby.rb --extout=.ext -- "./test/runner.rb"
C:/dev/ruby/downloads/ruby_trunk/lib/drb/drb.rb:834: [BUG] Segmentation fault
ruby 1.9.2dev (2009-11-01 trunk 25603) [i386-mingw32]

-- control frame ----------
c:0021 p:---- s:0088 b:0088 l:000087 d:000087 CFUNC :gethostbyname
c:0020 p:0058 s:0084 b:0084 l:000083 d:000083 METHOD C:/dev/ruby/downloads/ruby_trunk/lib/drb/drb.rb:834
c:0019 p:0053 s:0080 b:0080 l:000079 d:000079 METHOD C:/dev/ruby/downloads/ruby_trunk/lib/drb/ssl.rb:139
c:0018 p:0019 s:0070 b:0070 l:000061 d:000069 BLOCK C:/dev/ruby/downloads/ruby_trunk/lib/drb/drb.rb:759
c:0017 p:---- s:0067 b:0067 l:000066 d:000066 FINISH
...

gethostbyname works fine with 1.9.1

Thanks!
-r
=end


Related issues

Has duplicate Ruby master - Bug #2686: Socket::gethostbyname => SEGFAULTClosed01/29/2010nobu (Nobuyoshi Nakada)Actions
#1

Updated by usa (Usaku NAKAMURA) over 10 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)

=begin
FYI, this problem only occurs with mingw version.
=end

#2

Updated by rogerdpack (Roger Pack) over 10 years ago

=begin
Perhaps it is getting confused between ipv6 and 4? (after compiling with -g3

(gdb) print *addr
$6 = {sin6_family = -1912, sin6_port = 34, sin6_flowinfo = 1851828526, sin6_addr = {_S6_un = {_S6_u8 = "╕{>\000╨Y\236\000p¿`n\002\000\000", _S6_u16 = {31672, 62, 22992, 158,
43120, 28256, 2, 0}, _S6_u32 = {4094904, 10377680, 1851828336, 2}}}, sin6_scope_id = 4102464}
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
make_hostent_internal (arg=0x6e614d88) at raddrinfo.c:431
431 if (addr->ai_canonname) {
=end

#3

Updated by rogerdpack (Roger Pack) about 10 years ago

=begin
Just as a note, this still occurs (I think only with GCC 3.4.5 mingw)

e:\dev\digitalarchive_trunk>ruby -rsocket -e 'Socket.gethostbyname("localhost")'
-e:1: [BUG] Segmentation fault
ruby 1.9.2dev (2010-01-24 trunk 26393) [i386-mingw32]

-- control frame ----------
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC :gethostbyname
c:0003 p:0017 s:0006 b:0006 l:0021a4 d:0021cc EVAL -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0021a4 d:0021a4 TOP


-e:1:in <main>'
-e:1:in
gethostbyname'

Thanks much.
-r
=end

#4

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

  • Status changed from Open to Feedback

=begin
I can't reproduce it on Windows Vista at all.
What's your platform, and the version of winsock2?
=end

#5

Updated by rogerdpack (Roger Pack) about 10 years ago

=begin
XP Pro, ws2_32.dll => 5.1.2600.5512 (gcc 3.4.5)
=end

#6

Updated by nobu (Nobuyoshi Nakada) about 10 years ago

=begin
Hi,

At Sat, 30 Jan 2010 10:21:58 +0900,
Roger Pack wrote in [ruby-core:27962]:

XP Pro, ws2_32.dll => 5.1.2600.5512 (gcc 3.4.5)

It's 6.0.6001.18000 on Vista.

I'll try it on XP, if possible, later.

--
Nobu Nakada

=end

#7

Updated by vvs (Vladimir Sizikov) about 10 years ago

=begin
Easily reproducible on Windows 7 with latest 1.9.2 dev builds (with MINGW):

D:\work\jruby-dev>pik ruby -rsocket -e "p Socket.gethostbyname('localhost')"
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

["Oxford", [], 2, "\177\000\000\001"]

ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

["Oxford", [], 2, "\177\000\000\001"]

ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]

["Oxford", [], 2, "\177\000\000\001"]

ruby 1.8.7 (2009-06-12 patchlevel 174) [i386-mswin32]

["Oxford", [], 2, "\177\000\000\001"]

ruby 1.9.0 (2008-06-20 revision 17482) [i386-mswin32]

["Oxford", [], 2, "\x7F\x00\x00\x01"]

ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]

["Oxford", [], 2, "\x7F\x00\x00\x01"]

ruby 1.9.1p0 (2009-01-30 revision 21907) [x64-mswin64_80]

-e:1:in gethostbyname': unknown socket family:23 (SocketError)
from -e:1:in
'

ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]

["Oxford", [], 2, "\x7F\x00\x00\x01"]

ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]

["Oxford", [], 2, "\x7F\x00\x00\x01"]

ruby 1.9.2dev (2009-07-18) [i386-mswin32]

["Oxford", [], 2, "\x7F\x00\x00\x01"]

ruby 1.9.2dev (2009-11-12 trunk 25723) [i386-mingw32]

-e:1: [BUG] Segmentation fault
ruby 1.9.2dev (2009-11-12 trunk 25723) [i386-mingw32]

-- control frame ----------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :gethostbyname
c:0003 p:0018 s:0007 b:0006 l:0004ac d:00205c EVAL -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0004ac d:0004ac TOP


-e:1:in <main>'
-e:1:in
gethostbyname'

[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

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

ruby 1.9.2dev (2010-01-25 trunk 26402) [i386-mingw32]

-e:1: [BUG] Segmentation fault
ruby 1.9.2dev (2010-01-25 trunk 26402) [i386-mingw32]

-- control frame ----------
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :gethostbyname
c:0003 p:0018 s:0007 b:0006 l:00042c d:001b6c EVAL -e:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:00042c d:00042c TOP


-e:1:in <main>'
-e:1:in
gethostbyname'
=end

#8

Updated by rogerdpack (Roger Pack) almost 10 years ago

=begin
appears to not throw the segfault anymore...at least on a couple of my doze boxes.

e:\dev\digitalarchive_trunk>ruby -v -rsocket -e 'p Socket.gethostbyname("localhost")'
ruby 1.9.2dev (2010-03-06) [i386-mingw32]
["roger-pack", [], 2, "\x7F\x00\x00\x01"]

C:\dev\ruby\downloads>ruby -v -rsocket -e 'p Socket.gethostbyname("localhost")'
ruby 1.9.2dev (2009-08-09 trunk 24478) [i386-mingw32]
["ws-packrd", [], 2, "\x7F\x00\x00\x01"]

Anybody else seeing it?
=end

#9

Updated by rogerdpack (Roger Pack) almost 10 years ago

  • Status changed from Feedback to Closed

=begin
Seems to be working now.
=end

Also available in: Atom PDF