Projects

Ticket #160 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Opening a TCPSocket causes GC exception

Reported by: jamis@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.4
Component: MacRuby Keywords: ext socket
Cc:

Description

TCPSocket (perhaps other sockets, too, but TCPSocket for sure) apparently doesn't like MacRuby (or vice-versa):

require 'socket'
TCPSocket.open('localhost', 22)

Results in an nasty exception:

y.rb:2: [BUG] destination 0x7fff5fbfe810 isn't in the auto zone
MacRuby version 0.4 (ruby 1.9.0 2008-06-03) [universal-darwin9.0, x86_64]

-- stack frame ------------
0000 (0xc08120060): 00000004
0001 (0xc08120068): 00000000
0002 (0xc08120070): 00000004
0003 (0xc08120078): 00000000
0004 (0xc08120080): 00000004
0005 (0xc08120088): 00000000
0006 (0xc08120090): 100396320
0007 (0xc08120098): 800088a20
0008 (0xc081200a0): 0000002d
0009 (0xc081200a8): 00000004
0010 (0xc081200b0): 00000000
0011 (0xc081200b8): 00000004
0012 (0xc081200c0): 00000000 <- lfp <- dfp
-- control frame ----------
c:0005 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC  :initialize:
c:0004 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :open
c:0003 p:0027 s:0006 b:0006 l:000005 d:000005 TOP    y.rb:2
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH :inherited:
c:0001 p:0000 s:0002 b:0002 l:000001 d:000001 TOP    
---------------------------
DBG> : "y.rb:2:in `initialize:'"
DBG> : "y.rb:2:in `open'"
DBG> : "y.rb:2:in `<main>'"
-- backtrace of native function call (Use addr2line) --
0x1001095d1
0x100028c14
0x100028cf8
0x10003b735
0x10010a756
0x1046051e7
0x1046053b1
0x10460569e
0x10002cd9f
0x1046057a8
0x10460581b
0x1000ffc3f
0x1001000da
0x10010390e
0x100061da1
0x10004569e
0x1001048a7
0x1000f973b
0x1000fe622
0x1000fe8ac
0x10002c632
0x10002f9e7
0x100000f1f
0x100000ea4
0x2
-------------------------------------------------------
Abort trap

Change History

Changed 3 years ago by jamis@…

I managed to track it down to rb_fd_init in thread.c, the call to GC_WB, when rb_fd_init is called via wait_connectable in socket.c, called via ruby_connect (also in socket.c). I'm afraid I don't know the auto_zone API at all, so I'm unsure of how to proceed, but maybe this will save someone a little time investigating.

Changed 3 years ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to MacRuby 0.4

Good catch, the problem is in socket.c:1072, which should pass a pointer to the auto zone. I fixed it in r737/trunk.

But this will anyway be addressed once we rewrite the IO system. Currently there are too many problems with IO due to the way we handle byte strings.

Thanks for harnessing MacRuby :-)

Note: See TracTickets for help on using tickets.