Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

TypeError: Tried to use non-reference value 0x15a86 as type Bignum (10) #2011

Closed
ghost opened this Issue · 5 comments

2 participants

@ghost

I noticed this failure pop up on Travis consistently recently, and it looks like it is always reproducible from a local copy of a open source project I'm working on.
To reproduce:

git clone git://github.com/robgleeson/iprocess.git
cd iprocess
rbx -X19 -S bundle
rbx -X19 -S bundle exec rake

my environment:

✗ rbx -X19 -v     
rubinius 2.0.0dev (1.9.3 2242f14b yyyy-mm-dd JI) [x86_64-apple-darwin11.4.0]
@frodsan

Indeed. This is an issue on master.

Actual

frodsan$ rbx
>> require 'socket'
=> true
>> UNIXSocket.pair
=> [#<UNIXSocket:fd 5>, #<UNIXSocket:fd 6>]
>> UNIXSocket.pair :DGRAM
TypeError: Tried to use non-reference value 0x10d56 as type Bignum (10)
    from /Users/frodsan/.rbenv/versions/rbx-2.0.0-dev/lib/19/socket.rb:688:in `socketpair'
    from kernel/platform/pointer.rb:307:in `new'
    from /Users/frodsan/.rbenv/versions/rbx-2.0.0-dev/lib/19/socket.rb:687:in `socketpair'
    from /Users/frodsan/.rbenv/versions/rbx-2.0.0-dev/lib/19/socket.rb:864:in `pair (socketpair)'
    from (irb):3

Expected: Ruby 1.9.3-p3237

frodsan$ irb
>> require 'socket'
=> true
>> UNIXSocket.pair :DGRAM
=> [#<UNIXSocket:fd 5>, #<UNIXSocket:fd 6>]
@frodsan

It works if you use Socket::SOCK_DGRAM constant:

>> require 'socket'
=> true
>> UNIXSocket.pair Socket::SOCK_DGRAM
=> [#<UNIXSocket:fd 5>, #<UNIXSocket:fd 6>]
@frodsan

I made a poor fix to this frodsan/rubinius@e92e30b, but it's working:

>> require 'socket'
=> true
>> UNIXSocket.pair Socket::SOCK_DGRAM
=> [#<UNIXSocket:fd 5>, #<UNIXSocket:fd 6>]
>> UNIXSocket.pair :DGRAM
=> [#<UNIXSocket:fd 7>, #<UNIXSocket:fd 8>]
@frodsan frodsan referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@ghost

@frodsan cool, thanks for the workaround. It works as you say but fails on a different exception now (NoMethodError on UNIXSocket#recvmsg).

@frodsan

@robgleeson Yup, I saw that error. I will try to fix this first, thanks :smile:

@dbussink dbussink closed this issue from a commit
Francesco Rodriguez Fix Socket#socketpair on X19.
Socket#socketpair `type` argument can accept
a symbol that references to a `Socket::SOCK_*`
constant.

    require 'socket'

    # Before

    Socket.socketpair(Socket::PF_UNIX, Socket::SOCK_DGRAM, 0)
    # => [#<Socket:fd 11>, #<Socket:fd 12>]

    Socket.socketpair(Socket::PF_UNIX, :DGRAM, 0)
    # => TypeError: Tried to use non-reference value 0x15a86 as type Bignum (10)

    # After

    Socket.socketpair(Socket::PF_UNIX, Socket::SOCK_DGRAM, 0)
    # => [#<Socket:fd 7>, #<Socket:fd 8>]
    Socket.socketpair(Socket::PF_UNIX, :DGRAM, 0)
    # => [#<Socket:fd 9>, #<Socket:fd 10>]

Fixes #2011.
66c4dca
@dbussink dbussink closed this in 66c4dca
@warrenseen warrenseen referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@Gibheer Gibheer referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.